MaxAttemptsExceededException triggered due to overlapping job #43502
-
I have been troubleshooting failed jobs and have narrowed it down to the middleware I put on both jobs (
The jobs are (by design) not working with the same files on the server and so are queued simultaneously. I have seen that in the first try for each, one of them is getting It appears that the overlap middleware is causing this - does this seem right? I was expecting it should not fail at all and instead be preventing the starting of the job in the first place. Does the EDIT: I changed the job overlap keys to different strings and the same job is seen as failing if the job is queued in quick succession. The second job instance starts before the first job instance has ended, and the second job instance is seen as failing. EDIT 2: I just found missing parentheses around the WithoutOverlapping class. EDIT 3: with parentheses, still no difference. Example, I have
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It seems that without the |
Beta Was this translation helpful? Give feedback.
-
https://github.com/laravel/horizon/issues?q=is%3Aissue+MaxAttemptsExceededException+is%3Aclosed I would suggest not to use the WithoutOverlapping, since it does not work well with Horizon. |
Beta Was this translation helpful? Give feedback.
It seems that without the
->releaseAfter(<seconds>)
an overlapping job will essentially fail as it will quickly loop through it's afforded tries. This is not clear in the documentation, though it's implied with the explanation that an overlapping job will get released back to the queue... I guess it can only be released if it has started. If I am undestanding correctly,WithoutOverlap
middleware does not prevent overlap as the documentation says - it ends overlap at the cost of a try.https://laravel.com/docs/9.x/queues#preventing-job-overlaps