You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the database connection that used by queue worker is closed then it throws an exception, it won't detect the exception as connection related error. So, the queue worker won't retry to reconnect the database connection.
[2024-04-28 03:33:22] production.ERROR: SQLSTATE[HY000]: General error: 2006 Server has gone away (Connection: mysql, SQL: QUERY) {"exception":"[object] (Illuminate\\Database\\QueryException(code: HY000): SQLSTATE[HY000]: General error: 2006 Server has gone away (Connection: mysql, SQL: QUERY) at /home/u12345678/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829)
...
After looking at the code at src/Illuminate/Database/DetectsLostConnections.php
It appears that the method causedByLostConnection doesn't ignore the error message case, and my shared hosting server report the error as Server has gone away with an uppercase S instead of the usual server has gone away with a lowercase s.
Thus, it won't detect it as a connection lost and just throws the exception again.
The error message might be specific to MariaDB as I look into MariaDB source code at errmsg.c , it's indeed that MariaDB use different client error messages to MySQL.
Note: In the log above, I have replaced the query and username with a placeholder for security reason.
Steps To Reproduce
Start queue:worker
Wait until connection closed.
The queue worker will fail to detect the connection exception and throws it instead.
The text was updated successfully, but these errors were encountered:
As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.
If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.
Laravel Version
10.48.9
PHP Version
8.2.13
Database Driver & Version
MariaDB 10.6.16 for Linux (x86_64)
Description
When the database connection that used by queue worker is closed then it throws an exception, it won't detect the exception as connection related error. So, the queue worker won't retry to reconnect the database connection.
After looking at the code at
src/Illuminate/Database/DetectsLostConnections.php
It appears that the method
causedByLostConnection
doesn't ignore the error message case, and my shared hosting server report the error asServer has gone away
with an uppercaseS
instead of the usualserver has gone away
with a lowercases
.Thus, it won't detect it as a connection lost and just throws the exception again.
The error message might be specific to MariaDB as I look into MariaDB source code at errmsg.c , it's indeed that MariaDB use different client error messages to MySQL.
Note: In the log above, I have replaced the query and username with a placeholder for security reason.
Steps To Reproduce
The text was updated successfully, but these errors were encountered: