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
I am using the Amazon RDS database. When the master database fails over to slave, the master database is set by Amazon to read-only mode.
I am running queue workers with a database driver. Queue worker gets the exception that it can't write to the database anymore. The queue worker doesn't quit, it just retries the same query.
If the queue worker would quit, the supervisor would start a new one and it would get the new MySQL connection that is writable.
Steps To Reproduce
write at least one queue job to the jobs table
set MySQL into read-only mode DB::statement("ALTER DATABASE database_name READ ONLY = 1;");
run artisan queue:work
What is the problem?
In the Laravel logs, I get this error:
[2023-09-21 14:04:22] local.ERROR: SQLSTATE[HY000]: General error: 3989 Schema 'go' is in read-only mode. (Connection: MySQL, SQL: select * from jobs where queue = default and ((reserved_at is null and available_at <= 1695305061) or (reserved_at <= 1695294261)) order by id asc limit 1 FOR UPDATE SKIP LOCKED)...
And the worker doesn't quit after the error. And keeps retrying the same query indefinitely not processing any jobs.
What do I expect?
After such an error I expect a worker to quit.
It is probably not a very big problem, because queue jobs can be run not in "daemon" mode. Which avoids this problem.
The text was updated successfully, but these errors were encountered:
mantas-done
changed the title
Database queue worker doesn't quit on SQL error
Database queue worker doesn't quit on internal SQL error
Sep 21, 2023
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.24.0
PHP Version
8.2.8
Database Driver & Version
8.0.31-0ubuntu0.20.04.2 (Homestead)
Description
I am using the Amazon RDS database. When the master database fails over to slave, the master database is set by Amazon to read-only mode.
I am running queue workers with a database driver. Queue worker gets the exception that it can't write to the database anymore. The queue worker doesn't quit, it just retries the same query.
If the queue worker would quit, the supervisor would start a new one and it would get the new MySQL connection that is writable.
Steps To Reproduce
DB::statement("ALTER DATABASE database_name READ ONLY = 1;");
artisan queue:work
What is the problem?
In the Laravel logs, I get this error:
[2023-09-21 14:04:22] local.ERROR: SQLSTATE[HY000]: General error: 3989 Schema 'go' is in read-only mode. (Connection: MySQL, SQL: select * from
jobs
wherequeue
= default and ((reserved_at
is null andavailable_at
<= 1695305061) or (reserved_at
<= 1695294261)) order byid
asc limit 1 FOR UPDATE SKIP LOCKED)...And the worker doesn't quit after the error. And keeps retrying the same query indefinitely not processing any jobs.
What do I expect?
After such an error I expect a worker to quit.
It is probably not a very big problem, because queue jobs can be run not in "daemon" mode. Which avoids this problem.
The text was updated successfully, but these errors were encountered: