Skip to content

Conversation

trunneml
Copy link
Contributor

When the database connection dies (database server crash), the database scheduler of djcelery doesn't close the broken connection for its scheduler update calls. Every 5 seconds an OperationalError: (2006, 'MySQL server has gone away') occurs.

This patches checks the database connection when a DATABASE_ERROR occurs and closes the connection when necessary. The database scheduler reconnects automatically on the next try.

When the database connection dies (database server crash), the database scheduler of djcelery doesn't close the broken connection for its scheduler update calls. Every 5 seconds an OperationalError: (2006, 'MySQL server has gone away') occurs.

This patches checks the database connection when a DATABASE_ERROR occurs and closes the connection when necessary. The database scheduler reconnects automatically on the next try.
@auvipy
Copy link
Member

auvipy commented Aug 16, 2016

@trunneml hi, thanks for the patch, could you check the other PR's related to this issue? they are referenced here. I am going to asses which approach is better.

@trunneml
Copy link
Contributor Author

@auvipy hi, it's been along time since I worked with django-celery. But in my opinion it is best to try to close the db connection in case of an problem. Django will reconnect next time. Don't catching the exception could stop the beat which could be a problem.

My patch is based on the way how django handles such a case, so I prefer my patch. ;-)

@temoto
Copy link

temoto commented Dec 20, 2016

Is there any reason this patch was not merged?

@auvipy auvipy merged commit 00db9b7 into celery:master Dec 20, 2016
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

Successfully merging this pull request may close these issues.

3 participants