Replies: 1 comment
-
I was able to reproduce this with the following code
This is a scaled down approximation of what is happening for me. I ran this using a docker version of mariadb 10.6 on my local machine. Even though the mysql driver max and idle connection is set to 2, the database quickly becomes saturated in client threads up to the current set limit of 100. From my understanding, there should only be 2 connections created, which locally it looks like that is what is happening. Can anyone shed some light on if I am doing something wrong? |
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
-
I have a service that is writing batch insert statements with a context timeout.
Every once in a while the batch inserts cause the timeout context to hit and the application connection is reused for another batch insert into the DB. However, on the DB side, the session/connection remains open for however long the actual insert takes. Each of these are taking up a connection slot while in the worst case, GORM is creating new sessions to the db that also timeout and eventually all the slots are taken, locking the database.
Is there a way to ensure that a session is closed on context timeout and reduce this session leak?
Beta Was this translation helpful? Give feedback.
All reactions