-
Notifications
You must be signed in to change notification settings - Fork 11.4k
5.4 Queue:work fails. MySQL server has gone away #19072
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
Comments
Thanks @Broutard. To laravel staff: I can work on a PR to fix this issue if you confirm that's a bug. |
Sorry I have just seen that there are two Exceptions thrown :
So a QueryException is well thrown. But, this issue is still valid, because if you run artisan queue:work (a deamon), and if you use transactions,
The jobs workers are still running but are "down"... Maybe you should add this in the documentation! |
Maybe a fast solution is just kill the Queue Worker when this exception occurs, and the supervisor take cares of restarting it as already suggested on Laravel Docs |
At
Note that when an exception occours, the exeption is reported but is not throwed again.
and update
Note that I'm not sure if is necessary to wait for |
Not tested yet, but I think we can do this in our jobs :
|
@iget-master, it doesn't work. PR #19080 fix this issue |
Thanks to @taylorotwell |
Thanks @Broutard for the fix! |
最近遇到了同样的问题,我尝试了很多次,今天我测试了,我发现这个函数'tryAgainIfCausedByLostConnection',但是我不知道为什么当数据库连接超时时是没用的。 然后我检查错误的日志,发现'Laravel Queue'更新数据时使用事务,在处理事务时,它不会检测数据库链接是否有效,并直接引发异常。 在队列更新操作之前执行数据库查询时,'tryAgainIfCausedByLostConnection'方法工作并重新连接数据库。 |
Description:
Closed issue #19005 is not fixed.
In Illuminate/Database/Connection.php line 608, run() seems to don't catch all exceptions.
In this example, the PDOException is not catched by the
catch (QueryException $e)
sohandleQueryException()
is not executed.Steps To Reproduce:
The text was updated successfully, but these errors were encountered: