Laravel Version
11.46.0
PHP Version
8.2.27
Database Driver & Version
No response
Description
Worker::getNextJob() has a catch (Throwable) block with no retry limit. If the queue connection throws a non-database exception (e.g., SQS SDK timeout, auth error, HTTP failure), the worker enters an infinite loop: catch → sleep(1) → retry → catch → forever.
// Worker.php:372-378
} catch (Throwable $e) {
$this->exceptions->report($e);
$this->stopWorkerIfLostConnection($e); // only checks DATABASE errors
$this->sleep(1);
}
stopWorkerIfLostConnection() uses DetectsLostConnections which only matches MySQL/PostgreSQL/SQLite error strings. Queue connection failures (SQS, Redis, etc.) don't match, so shouldQuit is never set.
The worker also has no pcntl_alarm active during getNextJob() — the timeout handler is only registered during runJob() and cleared at resetTimeoutHandler() before the next call.
Impact: Worker container stays "Up" but processes zero messages indefinitely. In production we observed 4 of 7 workers stuck in this state for days.
Steps To Reproduce
Steps To Reproduce
- Run php artisan queue:work --queue=any-queue with a queue driver that throws on pop() (e.g., SQS with invalid credentials, or a mock driver)
- Worker loops forever in getNextJob() catch block
- --timeout, --memory, and --max-time do not stop it
Laravel Version
11.46.0
PHP Version
8.2.27
Database Driver & Version
No response
Description
Worker::getNextJob() has a catch (Throwable) block with no retry limit. If the queue connection throws a non-database exception (e.g., SQS SDK timeout, auth error, HTTP failure), the worker enters an infinite loop: catch → sleep(1) → retry → catch → forever.
stopWorkerIfLostConnection() uses DetectsLostConnections which only matches MySQL/PostgreSQL/SQLite error strings. Queue connection failures (SQS, Redis, etc.) don't match, so shouldQuit is never set.
The worker also has no pcntl_alarm active during getNextJob() — the timeout handler is only registered during runJob() and cleared at resetTimeoutHandler() before the next call.
Impact: Worker container stays "Up" but processes zero messages indefinitely. In production we observed 4 of 7 workers stuck in this state for days.
Steps To Reproduce
Steps To Reproduce