-
Notifications
You must be signed in to change notification settings - Fork 259
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
Pool auto reconnect #132
Comments
Do not follow, what is your use case? you mean tolerate server reboot? |
Because of timeout, network issues, mysql restart or other things that can happen, client loose connection, and when client tries to execute query - it fails. Usually driver replace the connection (for example in torndb). |
Could you provide failing test? We already have logic that checks connection before returning it to there user see: https://github.com/aio-libs/aiomysql/blob/master/aiomysql/pool.py#L147-L158 Also test for timeout case: Lines 439 to 459 in 93aa3e5
|
Maybe timeout is handled properly, but other exceptions are not? Here is an traceback:
|
Could you provide failing test case (also versions of aiomysql/python) so I can reproduce and debug issue? Right now it is not clear where is problem, even if it is in pool at all. As for your request, current pool do not support reconnection feature, we can make it more robust and more tolerant, but reconnection should live in separate pool implementation or helper function. |
I was unable to create a test for it, but it seems to happen only with Amazon RDS. I guess they don't close inactive connections properly. |
thanks for update! Probably to make pool more robust, we also can add connection recycling, after specified time, just close connection and create new one instead. |
Good idea |
Agree, need a pool_recycle in create_engine like sqlalchemy to handle rds disconnect. |
pool_recycle |
@offline
|
For connection lost, wonder if
|
I created PR with pool recycle here #216 |
Hey, I've stumbled upon the a similiar issue that concerns pool reconnect, except I wasn't using Amazon RDS, but our own nginx proxy in front of a galera cluster. I saw very strange behavior, when I disconnected one of the nodes behind the proxy, where my benchmarks went from 720 requests per second to 4, without any errors going through and never returning to normal unless I started that node back up, or restarted the pool. I've tried pretty much every option available in aiomysql and trying to set connection's The fix was to include Proxy config:
|
Can we replace the current connection in pool with a new one on error "Lost connection to MySQL server during query ([Errno 104] Connection reset by peer)"?
The text was updated successfully, but these errors were encountered: