puma: Puma won't die when killing rails server with ctrl-c
Steps to reproduce
-
run a tiny rails server, with puma configured in the Procfile
web: bundle exec puma -C config/puma.rb
-
start the rails server
-
kill the server in the terminal with ctrl-c
Expected behavior
The server should shut down
Actual behavior
Puma hangs with Gracefully shutting down workers...
. It’s undead, can’t be killed with another ctrl-c nor a ctrl-d. Even manually finding the processes by pid and killing them won’t unfreeze the server. Somehow puma can’t even be killed with pkill -f puma
System configuration
Ruby version: Ruby ruby 2.3.3
Rails version: Rails 5.0.1
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 9
- Comments: 19 (3 by maintainers)
Commits related to this issue
- Add kill-puma alias https://github.com/puma/puma/issues/1247 — committed to AlecRust/dotfiles by AlecRust 2 years ago
Cannot reproduce. 99% certain this is an issue on your end, rather than Puma. What happens if you send SIGKILL?
pkill -9 -f puma
I’ve found sending SIGQUIT (via
Ctrl-\
) will kill the process.Ah, I didn’t know you can pass -9 to pkill. That finally gets rid of it.
Also, lots of rb-fsevent processes stay open too. I kill everything with:
Output when it’s stuck in shutdown mode:
Not sure if there’s a sure-fire way to solve this or if the solution is simply to send SIGQUIT (via
Ctrl-\
), but I’m still having this issue as well.Does anyone know why these workers stop synching, specifically in the case that was mentioned 8 comments up on this gist, where you have set “Web_concurrrency” to { 2 }?
Can confirm SIGQUIT worked for me.
I believe this is the same issue as https://github.com/puma/puma/issues/1046. I’m still experiencing this with Rails 5.1 and Puma 3.10.0.
Edit: Hmm no, I think this is different. On previous versions of Puma/Rails I could specify
workers 1
in my puma config and as long as I started it withrails server -b 127.0.0.1
I could restart usingrails restart
. This is no longer the case. If I simply specify that I want to use a worker it fails to restart, hanging on “Gracefully shutting down workers…”. Settingworkers 0
seems to fix it though.