-
Notifications
You must be signed in to change notification settings - Fork 11k
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
[5.3] Daemon queue worker: Jobs that exceed timeout will never 'fail' #15317
Comments
maxbrokman
pushed a commit
to maxbrokman/framework
that referenced
this issue
Sep 7, 2016
…oo many times. Resolves an issue with the `--timeout` feature where jobs the repeatedly timed out would never be marked as `failed`, as the worker process would be killed before it could reach the failing logic. To maintain compatibility there are now two checks against the number of attempts a job has had, one before working the job and one in the case of an job raising an exception. see laravel#15317 for more details.
symfony-splitter
pushed a commit
to illuminate/queue
that referenced
this issue
Sep 7, 2016
…oo many times. Resolves an issue with the `--timeout` feature where jobs the repeatedly timed out would never be marked as `failed`, as the worker process would be killed before it could reach the failing logic. To maintain compatibility there are now two checks against the number of attempts a job has had, one before working the job and one in the case of an job raising an exception. see laravel/framework#15317 for more details.
Fixed in #15319 (hopefully :p) |
taylorotwell
pushed a commit
to illuminate/queue
that referenced
this issue
Sep 17, 2018
…oo many times. Resolves an issue with the `--timeout` feature where jobs the repeatedly timed out would never be marked as `failed`, as the worker process would be killed before it could reach the failing logic. To maintain compatibility there are now two checks against the number of attempts a job has had, one before working the job and one in the case of an job raising an exception. see laravel/framework#15317 for more details.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description:
The
timeout
option when runningartisan queue:work --daemon --timeout=n --tries=n
successfully kills child processes that run too long but they will never go through the job failure process.Jobs are marked as failed if they throw an exception during execution and have already been received by a worker too many times. This logic is handled in this method, which is only called from
Worker::process()
(throughhandleJobException
).This works well for normal jobs but jobs that exceed the timeout will never actually reach this point, as the parent process kills them while they are still working the logic to 'fail' a job will run.
Steps To Reproduce:
Send jobs to the queue that exceed the timeout and then attempt to work them, for example
Working the queue with
php artisan queue:work --daemon --timeout=5 --tries=1
I would expect to see this job appear once in output and then fail (ending up the in failed_jobs table etc).Instead the output is along the lines of
Suggested fix
Move the check for a job that has exceeded its maximum attempts to before the job fires. A job that has repeatedly timed out will then fail the next time the worker receives it.
I'm going to submit a PR for this shortly.
The text was updated successfully, but these errors were encountered: