diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-03-01 22:05:44 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-03-03 11:13:14 -0800 |
commit | 571f38c6c9efd776b0704ddba35078c972289de6 (patch) | |
tree | 400835794fa794758deba76192976cf78f0ccd43 | |
parent | 695954139e17e186d31b32f476048832994f0022 (diff) | |
download | unicorn-571f38c6c9efd776b0704ddba35078c972289de6.tar.gz |
Relying on at_exit can still means a child might get it if there's any race condition....
-rw-r--r-- | lib/unicorn.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/unicorn.rb b/lib/unicorn.rb index fa2ebe8..4e09b0c 100644 --- a/lib/unicorn.rb +++ b/lib/unicorn.rb @@ -120,7 +120,6 @@ module Unicorn "(or pid=#{path} is stale)" end File.open(path, 'wb') { |fp| fp.syswrite("#{$$}\n") } - at_exit { unlink_pid_safe(path) } end unlink_pid_safe(@pid) if @pid && @pid != path @pid = path @@ -220,6 +219,7 @@ module Unicorn end stop # gracefully shutdown all workers on our way out logger.info "master PID:#{$$} join complete" + unlink_pid_safe(@pid) if @pid end # Terminates all workers, but does not exit master process |