about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorGraham Bleach <graham@darkskills.org.uk>2012-02-29 14:34:44 +0000
committerEric Wong <normalperson@yhbt.net>2012-02-29 17:12:30 +0000
commit2ce57950e0f61eb6f325a93cef9b7e0e598fc109 (patch)
tree39eb491ca57fa5d15dbaa1faa331e47a3b432b32
parentb6a154eba6d79fd1572f61290e55f4d05df86730 (diff)
downloadunicorn-2ce57950e0f61eb6f325a93cef9b7e0e598fc109.tar.gz
If unicorn doesn't get terminated cleanly (for example if the machine
has its power interrupted) and the pid in the pidfile gets used by
another process, the current unicorn code will exit and not start a
server. This tiny patch fixes that behaviour.

Acked-by: Eric Wong <normalperson@yhbt.net>
-rw-r--r--lib/unicorn/http_server.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb
index 7d2c623..0c2af5d 100644
--- a/lib/unicorn/http_server.rb
+++ b/lib/unicorn/http_server.rb
@@ -656,7 +656,7 @@ class Unicorn::HttpServer
     wpid <= 0 and return
     Process.kill(0, wpid)
     wpid
-    rescue Errno::ESRCH, Errno::ENOENT
+    rescue Errno::ESRCH, Errno::ENOENT, Errno::EPERM
       # don't unlink stale pid files, racy without non-portable locking...
   end