Repository navigation
Fix worker being killed 15s after a job calls Artisan::call() - #4
Conversation
The exit watchdog listener is shared by Horizon's forked workers and plain queue:work workers, so the same job killed a queue:work worker 15 s after its Artisan::call(). The test fails on main and passes with the fix.
|
Thanks Ali, great catch and a very clear write-up. You're right: I reproduced it and pushed one commit on top of yours:
The Horizon and |
A job that calls Artisan::call() and keeps working past exit_grace no longer gets its worker killed: the exit watchdog is armed when the console kernel terminates instead of on CommandFinished (#4). CHANGELOG for 1.1.1.
Thank you. |
A job that calls
Artisan::call()and then keeps working for more than 15 seconds gets its worker killed mid-job. Stock workers are fine.The exit watchdog is armed on
CommandFinished, and Laravel fires that forArtisan::call()too. So the watchdog starts counting inside the job and replaces the worker's own SIGALRM timeout handler. 15s later the worker dies. The job isn't marked failed, it just runs again afterretry_after.To reproduce:
The fix: arm the watchdog from the console kernel's
terminate()instead. Laravel only calls that once, after the command the process was started for.Artisan::call()never gets there. On Laravel 11.18+ that's theTerminatingevent, on older 11.x it's$app->terminating().Added a
calls-artisanfixture and a test inStockParityTest. It times out on main and passes here. Unit, Mechanics and the Integration suite (host mode) pass.I haven't run the older-Laravel fallback on a real 11.0 install, only read the kernel code for it.