-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connections in pool have an infinite lifetime #1276
Comments
Sounds good to me. Please send us a PR :) |
I am working on a PR for this now. My first attempt at this is using
If the connection is expired, it is purged and To test this new feature though, we have to simulate the passage of time in order to have an expired connection. Not sure how @dougwilson or the maintainers as a whole would like to accomplish that. A couple of ideas:
|
It looks like #505 might already provide a better implementation of this feature (polling the connection pool for expired connections). |
If i understand you clearly and to contribute, dont you think a lifetime of connection is more killing to you server, interupts approach is better |
I don't think #505 is relevant here. That PR periodically polls the server to determine whether or not the sever has closed the connection. Solving the problem described in this ticket would require the client to actively close the connection after it sits idle for some period of time. |
Has this been resolved yet? If not I might give it a try next weekend or so and send in a PR. |
AFAIK, it does not appear to have been resolved. |
I don't think this is necessary now. That's because |
I have a process running all the time and when it idles for a while the connections in the pool are in a sleeping state. Eventually MySQL purges those connections based on the
wait_timeout
setting inmy.cnf
. Once this happens and I try to use a connection it will fail because the module assumes the connection is still live and tries to use it only to get a timeout or connection exception.I would propose adding an option when creating a pool
connection_lifetime
which will work in a following way. When getting a connection from the pool, if theconnection_lifetime
is not exceeded we simply return the connection, if however it is exceeded we kill the selected free connection and create a new one in it's place. That should solve the issue.The text was updated successfully, but these errors were encountered: