Skip to content
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

Closed
sheldonh opened this issue Oct 12, 2009 · 10 comments
Closed

MySQL server has gone away #15

sheldonh opened this issue Oct 12, 2009 · 10 comments

Comments

@sheldonh
Copy link

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.

@stephankaag
Copy link

Same issue overhere.

@scottj97
Copy link

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.

@sheldonh
Copy link
Author

When the MySQL server times the connection out, as per the MySQL server's configured wait_timeout setting.

@scottj97
Copy link

Doesn't DJ continuously poll the MySQL server? Why would it time out?

@sheldonh
Copy link
Author

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.

@bkeepers
Copy link

Sounds like this isn't necessarily a dj issue. Reopen if I'm wrong

@andrewroth
Copy link

what's the workaround?

@bracken
Copy link

bracken commented Mar 2, 2010

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
You could do the same thing in your custom daemons so that you can still use the main delayed_job branch.

@bkeepers
Copy link

For those still having this issue, make sure you try this first: http://guides.rubyonrails.org/2_3_release_notes.html#reconnecting-mysql-connections

@sheldonh
Copy link
Author

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.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants