-
Notifications
You must be signed in to change notification settings - Fork 1
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
Database connections lost after any time waiting #1
Comments
Possible solutions:
So why is this working on MySQL? A worker with just one job every 24 hours seems to work, and the MySQL database connections certainly don't last that long. Is Laravel handling the reconnections automatically for us, but missing the SQL Server failed connections due to the nature of the error ("connection not usable" rather than "not connected"). It seems like the process still thinks it is connected, but the database thinks it isn't, and the Azure infrastructure in between is not joining up the dots to tell the process it has lost the database connection. |
Some info that may be useful here: https://laracasts.com/discuss/channels/laravel/database-aborted-connections-with-queue-daemon It seems that Laravel does automatically reconnect MySQL database connections automatically, which will explain how that works.
|
This may just be a Laravel Issue raised here: laravel/framework#23925 Hopefully it's a simple fix, which I am trying now, and will generate a PR if it works. |
This is pushed over to the Laravel project (Laravel should hide the lost connections from the application), so closing this issue. |
This is a problem I've not seen on MySQL but am seeing on Azure SQL Server.
If no jobs are processed for some time - in the order of a few hours - then the database connection seems to "go bad". This results in a failure to dispatch any further jobs from the queue, with an error:
I guess the events are registered in the long-running job worker process, and it is that process that attempts to log the job details, and the database connection does not stay open for long waiting for that to happen.
The exception also does not put the job into the failed jobs queue, so it is effectively lost. This means it is absolutely essential that no event handlers registered against the job dispatcher must throw ANY exceptions. It is very important to catch any kind of error, perhaps log it, but then return to the caller.
The text was updated successfully, but these errors were encountered: