-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
Description
Steps to reproduce
- Create a
config.rbfile with this content and runmkdir -p tmp/pids
# frozen_string_literal: true
app_dir = File.expand_path(__dir__)
workers 4
threads 1, 8
bind "tcp://0.0.0.0:#{ENV.fetch('PORT', 3000)}"
pidfile "#{app_dir}/tmp/pids/puma.pid"
state_path "#{app_dir}/tmp/pids/puma.state"
app do |env|
puts env
body = 'Hello, World!'
[200, { 'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }, [body]]
endpuma -C config.rb- Send a
TERMsignal to the cluster process
$ /bin/kill -TERM `cat tmp/pids/puma.pid`
Expected behavior
Gracefully shuts down workers
Actual behavior
Process hangs, requires KILL
System configuration
Ruby version: 2.6.2
Puma version: 3.12.1
Platform: Ubuntu 18.04 (4.15.0-1032-aws)
Additional info
It works with Ruby 2.5.5.
I discovered this using puma with systemd, it times out and kills the process after a certain time. I checked the signals docs, with INT is really working but from the documentation is not clear if I can just use this signal instead without any other side effect.
if in systemd service descriptor I set ExecStop=/bin/kill -INT $MAINPID , it seems to work but it throws this error like it tries to stop the server twice:
api-puma[28423]: [28423] - Gracefully shutting down workers...
api-puma[28423]: [28423] - Gracefully shutting down workers...
api-puma[28423]: /opt/myapp/shared/vendor/ruby/2.6.0/gems/puma-3.12.1/lib/puma/cluster.rb:40:in `waitpid': No child processes (Errno::ECHILD)
christos, TheMasterCado, fixr, dentarg, AlexKVal and 2 more