Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Worker external TERM signalling #1952

Merged
merged 1 commit into from Sep 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/puma/cluster.rb
Expand Up @@ -216,8 +216,10 @@ def check_workers(force=false)
log "- Stopping #{w.pid} for phased upgrade..."
end

w.term
log "- #{w.signal} sent to #{w.pid}..."
unless w.term?
w.term
log "- #{w.signal} sent to #{w.pid}..."
end
end
end
end
Expand Down Expand Up @@ -266,6 +268,7 @@ def worker(index, master)
server = start_server

Signal.trap "SIGTERM" do
@worker_write << "e#{Process.pid}\n" rescue nil
server.stop
end

Expand Down Expand Up @@ -497,8 +500,11 @@ def run
w.boot!
log "- Worker #{w.index} (pid: #{pid}) booted, phase: #{w.phase}"
force_check = true
when "e"
# external term, see worker method, Signal.trap "SIGTERM"
w.instance_variable_set :@term, true
when "t"
w.term
w.term unless w.term?
force_check = true
when "p"
w.ping!(result.sub(/^\d+/,'').chomp)
Expand Down