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 #15
Comments
Same issue overhere. |
See line 64 of lib/delayed/command.rb. Looks like it's trying to reconnect. When exactly do you have a problem? I tried restarting my app after launching delayed_job, and that did not seem to cause any problems. Delayed jobs still get run. |
When the MySQL server times the connection out, as per the MySQL server's configured wait_timeout setting. |
Doesn't DJ continuously poll the MySQL server? Why would it time out? |
Aha! Found it. The application uses two databases (on two different servers). DJ isn't being timed out by the server on which the delayed_jobs table exists; but one of the delayed jobs accesses a legacy database, on another server, and that's where the timeout occurs. |
Sounds like this isn't necessarily a dj issue. Reopen if I'm wrong |
what's the workaround? |
I had this problem too because our delayed_job table is in a different database than our app. For those looking, here is my simple fix: http://github.com/bracken/delayed_job/commit/b73a7e561b89fc09ae77bb9c1cfc680062867e19 |
For those still having this issue, make sure you try this first: http://guides.rubyonrails.org/2_3_release_notes.html#reconnecting-mysql-connections |
Bracken's take on the issue makes the world of sense. Our problem is also from using multiple databases, where the jobs aren't stored in the database that the in-job code interacts with. |
It looks like the delayed_job daemon started by script/delayed_job doesn't try to reconnect to the database. That would be a good idea. Otherwise, once your connection breaks, delayed job processing stops forever.
The text was updated successfully, but these errors were encountered: