Why does gorm create a session for every new nested transaction? #7586
Replies: 1 comment
-
I tried and failed to make a reproducible test in gorm-playground. The new session seems to be reusing the client connection and cannot make it hang. Closing as FP for now |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In finisher_api.go:640 we create a new connection.
This can lead to a situation where we exhaust our connection pool with the parent connection, and then get "application dead-locked" by waiting for new sessions in the pool.
Is this on purpose and if so why? Or, if it's not, could it be considered a bug? For context, I've not found it done in other libraries (e.g sequelize) and Gemini AI seems to indicate that session reuse is the common practice. See refs below for more context.
(just checking before I go through and create a repro branch in gorm playground)
Refs:
Beta Was this translation helpful? Give feedback.
All reactions