I am facing an odd behavior of the Symfony Messenger component. I set it up according to the documentation and I am issuing a messenger:stop-workers
signal on each deploy as instructed here. However, a bug occurred in our system which I traced back to the fact that an old version of the code was being used by the Messenger workers.
Upon some more investigation, this is what happens in our setup:
- A worker is running, managed by supervisor.
- Just for debugging of this particular case, I start a new worker in the terminal
app/console messenger:consume --env=prod -vv async
to see what happens - I issue the stop command
app/console messenger:stop-workers --env=prod
- I would now expect that both the workers would be stopped (and supervisor would restart the one it's handling). However, that does not happen. The "debugging" worker does stop, but the one running under supervisor does nothing.
The supervisor-managed workers are limited to 1 hour of process time, after which they are stopped and restarted. I can see in the supervisord.log
that this works well. Every hour there are log entries about the processes stopping and starting. But there is nothing whatsoever about them stopping from the messenger:stop-workers
command.
I'm looking for ideas on why this would happen. I read the implementation of the workers and the shutdown signal is sent through a cache, but I did not find any problems in our configuration of it.
supervisorctl restart all
on deployment isn't an option? – Curia