-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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] Catch errors when handling a failed job #16212
[5.3] Catch errors when handling a failed job #16212
Conversation
Handles errors when calling the failed method on a job. Could be ReflectionException or an exception with unserializing the payload.
Thanks for tracking down this issue. I wonder if there is a more specific way to catch this error. It seems like could also be catching unrelated errors in this try / catch block and immediately marking things as failed for other reasons? Maybe that's what we want to happen? Do you have any thoughts there? |
failJob gets called from 2 separate places. Better to put this code around a try catch instead of in the try catch in handleJobException
… fix-queue-failed-job-event # Conflicts: # src/Illuminate/Queue/Worker.php
@taylorotwell I believe that we would want to catch all errors. We need the failed job event to get fired; otherwise, jobs will be lost. The smallest change I can think of is using a try catch to ensure that the failed job event gets fired. I can't think of any other solutions without doing larger changes to the After looking at this issue some more I realized that Instead of putting a |
And this still fixes the issue on your end? |
Yup this still fixes the issue on our end, I ran through the test case again to be sure. |
100% agree with @brianmclachlin. It doesn't matter where the exception comes from, I'm under the opinion that the failing job should be sent to failed jobs table with the recorded exception in all cases. A failed job should only be removed from the failed jobs table if: A) A developer runs |
@taylorotwell Not sure why travis is failing. The job log doesn't give me any output. |
@taylorotwell Travis for some reason had output this morning. Figured out what broke the tests and fixed it. |
Thank you @taylorotwell 👌 |
More explanation in my comment on this issue
TLDR;
If there is any problems with the payload of a job then the failed job event will not fire and the job is lost.