-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MySQL Server has gone away error occurs in multithreaded envirionment #387
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
Comments
Michael Bayer (@zzzeek) wrote: Ok, actually, the problem seems like it might be the rollback() call in connection._close(), removing it seems like 0.3.1 might work as well. but 0.2.7 has the same step. not sure whats different. |
Michael Bayer (@zzzeek) wrote: tentatively resolving in changeset:2133. the _close method on ConnectionFairy was not dereferencing the connection object. when del was called on the CF, it would again try calling rollback() on the referenced connection; even though that connection had already been allocated by a CF in a different thread, producing the invalid state. |
Changes by Michael Bayer (@zzzeek):
|
Anonymous wrote: This problem has resurfaced in:
It happens at irregular intervals, after a day or two. Restarting the process makes it go away.
|
Changes by Anonymous:
|
Michael Bayer (@zzzeek) wrote: the error you've posted is not the error this ticket describes. this is a problem with your MySQL server/environment, and/or a lack of an appropriate pool_recycle on your connection pool;. SQLAlchemy doesn't do anything that would case MySQL to lose a connection. its possible you just need to specify pool_recycle on your engine so that MySQL's normal timeout of 8 hours on a connection is never reached within SA's connection pool. |
Changes by Michael Bayer (@zzzeek):
|
Anonymous wrote: So it is correct that if whatever error happens that invalidates a connection to a database, sqlalchemy keeps this connection in the pool? |
Anonymous wrote: That's not a good thing. That would mean that every user would have to check if connections are dead all the time on it's own. By now I thought that SQLAlchemy recovers closed connections automatically. |
Changes by Anonymous:
|
Anonymous wrote: (original author: ants) This is actually #625. |
Changes by Anonymous:
|
Migrated issue, originally created by Michael Bayer (@zzzeek)
thought this could not be fixed, but 0.2.7's pool does not have the error....the fix may be incompatible with the connection pool's "cursor cleanup" function which was also meant to appease MySQL....
The text was updated successfully, but these errors were encountered: