Skip to content

fix(db): close startup connections so forked workers do not share them - #106

Merged
renarin-kholin merged 1 commit into
masterfrom
fix/db-connections-after-fork
Nov 28, 2026
Merged

renarin-kholin merged 1 commit into
masterfrom
fix/db-connections-after-fork

Conversation

@renarin-kholin

Copy link
Copy Markdown
Member

Summary

  • Logging in intermittently failed with MySQL server has gone away (Broken pipe)
  • The server loads the app once and forks the workers from that process. db.create_all() at startup opened pooled MySQL connections there, so every worker inherited and shared the same sockets, which pool_pre_ping cannot detect
  • Dispose all engines right after the startup create_all() so each worker opens its own connections

@renarin-kholin
renarin-kholin merged commit fbffc72 into master Nov 28, 2026
3 checks passed
@renarin-kholin
renarin-kholin deleted the fix/db-connections-after-fork branch November 28, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant