Laravel queue jobs keep failing silently, how do you actually debug that?
Our Laravel queue jobs just disappear sometimes with literally nothing in the logs. Half the time there's no error at all, the job just vanishes. What's the actual right way to track this down?
3 Answers
No answers yet.
-
10
✓ Accepted answer
This one's annoying because it's usually not an exception at all. First thing, check your failed_jobs table and make sure your job class actually has a failed() method so it logs something useful. But honestly 9 times out of 10 when we've seen jobs vanish with zero error, it's the worker getting OOM killed mid-job before it even gets a chance to log anything. Run queue:work with -vvv and keep an eye on memory while it's under load.
Team
-
6
This was exactly our issue, Supervisor was restarting the worker on OOM before the exception even got logged anywhere. Lowered the --memory flag and checked dmesg and that's how we finally caught it.
-
2
Also worth checking if you've got a try/catch somewhere upstream silently swallowing the exception. Happened to us in a custom job base class, took forever to find.