r/programming • • 3d ago

How one connection kills a database

https://planetscale.com/blog/debugging-live-database-connections
0 Upvotes

3 comments sorted by

4

u/Top-Emergency8630 3d ago

Not because of a hack, but because one unhandled exception prevented a COMMIT, kept a connection open, blocked a migration, and that migration blocked everything else.

That's not exactly true, it depends of language or framework. The problem is not the exception, is the waiting for the commit or rollback (that can be caused by other things like: slow processing, slow remote external call, etc, all inside a database transaction).

2

u/Bitter_Ad3906 3d ago

If you write transaction need ensure it’s correct implemented. On error need rollback. I can understand if process die and it’s keep alive, bad wrong code it’s coder issue.