Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRollback transactions on panic #1646
Comments
This comment has been minimized.
|
I disagree that this should be handled in Diesel. Transactions that do not explicitly commit will be rolled back when the connection is dropped. This is a problem specific to connection pooling, and should be handled there. |
sgrif
closed this
Apr 19, 2018
This comment has been minimized.
|
I strongly disagree with this decision: the transaction function creates a scope for the transaction, and it is fully expected that the transaction not be open after the end of that scope, regardless of how the scope is left. That's not a problem that's specific to connection pooling. |
sgrif
referenced this issue
Apr 20, 2018
Closed
Roll back transactions on panic and report connection status #1652
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Diggsey commentedApr 17, 2018
Related to sfackler/r2d2#31
Transactions should be rolled back if the inner function panics. The rollback code should take care not to panic in this case, to avoid double panics. Failure to do this can result in connections being returned to the pool with open transactions, which means database locks are held indefinitely, and future uses of the connection will cause further panics.