-
Notifications
You must be signed in to change notification settings - Fork 73
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
MySQL server has gone away #2
Comments
I have not used this with MySQL (I'm using Postgres for my projects), and I don't have this problem with postgres. |
I've created a demo project running a celery task every 2 second updating a self publishing model. |
Thanks for trying to re-create my issue. It seems like my MySQL server is running into a connection limit and randomly aborts connections. I get tons of the following errors:
Let me check if I can increase that limit. |
Okay, got it. The MySQL wait_timeout parameter was set too low. 600 seconds is not enough for the SwampDragon server. Does it perform any kind of heartbeat operation to keep the database connection open? |
Currently it doesn't. I would like to know how to replicate this issue. |
It seems like increasing wait_time only delays the problem. Here is the my.cnf used for mariadb-server (10.0.13+maria-1~wheezy) and the relevant environment-specific Django config: https://gist.github.com/mback2k/899fced7241f64b50793. The remaining Django config can be found here: https://github.com/mback2k/django-webgcal/tree/master/webgcal/settings. |
I've managed to replicate this issue now (thanks for the settings). It wasn't until I added
to settings that this started happening. I've created a gist for this for now until I figure out what to do in the long run: Let me know if that solves the problem. Remember to update the connection in settings:
|
I ran a very simple test to make sure there wasn't a significant performance loss with this solution (and there wasn't). The test is very simple and does the following:
With the gist provided above, I ran the test five times: With the default connection: |
Thanks for providing this workaround. I verified that it also solves the problem for me. I also tried to alternatively set CONN_MAX_AGE to something below wait_timeout, but that alone didn't help. Maybe you want to include that heartbeat into the default connection and make it detect MySQL like this:
|
I've thought about it for a bit now and it would be clever to check the DB engine, however the timeout is posing a bit of a problem. I wrote up a short blog post about it (http://swampdragon.net/blog/mysql-server-has-gone-away/) instead. Good suggestion though |
After some time the tornado server runs into the following error for each WebSocket connection. Any idea why this might happen while the MySQL server is still there? I guess it might be a problem related to connection timeouts:
The text was updated successfully, but these errors were encountered: