php
system_error
ai_generated
true
Symfony\Component\Process\Exception\ProcessTimedOutException: The process "'php' 'artisan' 'queue:work' '--queue=high,default' '--timeout=60'" exceeded the timeout of 60 seconds.
ID: php/laravel-queue-worker-timeout-exceeded
85%Fix Rate
85%Confidence
1Evidence
2024-02-18First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Laravel 9 | active | — | — | — |
| Laravel 10 | active | — | — | — |
| Laravel 11 | active | — | — | — |
Root Cause
The Laravel queue worker process is being killed by the timeout setting because a job is taking longer than the configured timeout to execute, often due to slow external API calls, database queries, or infinite loops.
generic中文
Laravel 队列工作进程因超时设置而被杀死,因为某个作业的执行时间超过了配置的超时时间,通常是由于外部 API 调用缓慢、数据库查询慢或无限循环。
Official Documentation
https://laravel.com/docs/10.x/queues#timeoutWorkarounds
-
75% success Increase the timeout for the specific queue worker: `php artisan queue:work --timeout=120` (set to 120 seconds). Also update the `--timeout` option in your supervisor configuration if using it.
Increase the timeout for the specific queue worker: `php artisan queue:work --timeout=120` (set to 120 seconds). Also update the `--timeout` option in your supervisor configuration if using it.
-
85% success Identify and optimize the slow job. Add logging to track execution time: `$start = microtime(true); // ... job logic ... \Log::info('Job took: ' . (microtime(true) - $start) . ' seconds');` Then refactor the job to use chunked processing, caching, or queueable API calls.
Identify and optimize the slow job. Add logging to track execution time: `$start = microtime(true); // ... job logic ... \Log::info('Job took: ' . (microtime(true) - $start) . ' seconds');` Then refactor the job to use chunked processing, caching, or queueable API calls.
中文步骤
Increase the timeout for the specific queue worker: `php artisan queue:work --timeout=120` (set to 120 seconds). Also update the `--timeout` option in your supervisor configuration if using it.
Identify and optimize the slow job. Add logging to track execution time: `$start = microtime(true); // ... job logic ... \Log::info('Job took: ' . (microtime(true) - $start) . ' seconds');` Then refactor the job to use chunked processing, caching, or queueable API calls.
Dead Ends
Common approaches that don't work:
-
Setting the timeout to a very high value like 3600 seconds without investigating the root cause
80% fail
This only masks the problem; if a job hangs indefinitely, it will still eventually timeout or consume excessive resources, and the queue will stall.
-
Restarting the queue worker with `php artisan queue:restart`
95% fail
Restarting does not fix the underlying slow job; the job will be retried and fail again with the same timeout.