Skip to content

Commit

Permalink
Fix sigterm misbehavior (puma#2629)
Browse files Browse the repository at this point in the history
* Log error if worker can not be started

* Removed sleeping of worker

* Runned rubocop
  • Loading branch information
Y authored and JuanitoFatas committed Sep 9, 2022
1 parent 67ec012 commit bfc5467
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/puma/cluster/worker.rb
Expand Up @@ -33,7 +33,7 @@ def run
Signal.trap "SIGINT", "IGNORE"
Signal.trap "SIGCHLD", "DEFAULT"

Thread.new do
Thread.new do
Puma.set_thread_name "worker check pipe"
IO.select [@check_pipe]
log "! Detected parent died, dying"
Expand All @@ -54,7 +54,14 @@ def run
# things in shape before booting the app.
@launcher.config.run_hooks :before_worker_boot, index, @launcher.events

begin
server = @server ||= start_server
rescue Exception => e
log "! Unable to start worker"
log e.backtrace[0]
exit 1
end

restart_server = Queue.new << true << false

fork_worker = @options[:fork_worker] && index == 0
Expand Down

0 comments on commit bfc5467

Please sign in to comment.