Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

clat23's avatar

How to manually (terminal command) delete queue workers

I created too many processes of queue workers in Forge. The memory on my server could not handle it. I tried deleting the workers via the Forge interface, however my server was still overloaded and did not get the delete message from Forge. (As a matter of fact, my site went down because the server was too overloaded) Forge now shows 1 active worker, but when I check worker status it still shows the 51 processes. I have upgraded the memory on my server so I can try to delete the 50 processes, but because they are not listed on the Active Workers list in Forge, I am unable to remove them. Is there a terminal command I can run to delete the workers?

0 likes
5 replies
bobbybouwmann's avatar

You have to kill the processes yourself on the server. So if you run top on the command line you can see all processes that are running. Then find the process you want to kill and find the id of that process in the table you get from top. It's called the PID. If you have the correct PID you can then run this

kill -9 1234

Source: https://www.booleanworld.com/kill-process-linux/

2 likes
clat23's avatar

Thank you. It looks like we are on the right track. I am able to kill the process easily as Forge provides me with all of the PIDs. But the problem is that it seems like the process revives itself as a new process. I am not noticing less queue workers, I have the same number after killing; new ones come up with new PIDs and a shorter uptime.

worker-128442:worker-128442_00   RUNNING   pid 13259, uptime 0:05:31
worker-227218:worker-227218_00   RUNNING   pid 28971, uptime 0:02:20
worker-227219:worker-227219_00   RUNNING   pid 2009, uptime 2:16:40
worker-227220:worker-227220_00   RUNNING   pid 1879, uptime 2:16:45
worker-227221:worker-227221_00   RUNNING   pid 1878, uptime 2:16:45
worker-227222:worker-227222_00   RUNNING   pid 1877, uptime 2:16:45
clat23's avatar

After more digging it looks like the process that I kill gets restarted by supervisord (another process that monitors its subprocesses--which are the queue workers that I am trying to kill). https://unix.stackexchange.com/questions/158194/kill-a-process-that-keeps-restarting

So I've found the docs for Supervisord here: http://supervisord.org/running.html#signals and found that supervisorctl stop <task name> stops the process. Doing a php artisan queue:restart does not restart it...which is good. However I am not able to delete the process. It just sits there with a status of "STOPPED". I am trying to figure out how to delete it for good and there doesn't seem to be a supverisorctl command for that...

clat23's avatar
clat23
OP
Best Answer
Level 3

Finally figured it out. Laravel Queue Workers are monitored by Supervisor (supervisord). A queue worker (or group of workers) are automatically configured by Forge using the GUI. When a queue worker is created by Forge, it creates a worker-[id].conf file in /etc/supervisor/conf.d When a queue worker is removed via the Forge GUI, the worker-[id].conf file is simply deleted (a restart may need to occur).

So the answer to my question "How to manually delete queue workers": SSH into the server, navigate to /etc/supervisor/conf.d folder and delete the worker-[id].conf files. After that, run sudo service supervisord restart, or sudo supervisorctl and then reread.

https://laravel.com/docs/5.8/queues#supervisor-configuration https://laracasts.com/discuss/channels/forge/create-a-single-queue-worker-processing-multiple-queues

Special thanks to @bobbybouwmann for pointing me in the right direction

7 likes

Please or to participate in this conversation.