Permalink
Browse files

"stop" command may cause EPIPE when sending to child if child shuts d…

…own quickly: catch and ignore
  • Loading branch information...
1 parent e48836b commit f5dbe28a2441982a800529c55dc0ae2c89ec2f49 @telent committed May 20, 2011
Showing with 8 additions and 2 deletions.
  1. +8 −2 lib/thin/prefork/worker.rb
@@ -63,7 +63,7 @@ class Controller < ::EventMachine::Connection
attr_accessor :app,:control_socket,:pid,:host,:port,:stderr
include Thin::Prefork::Worker::Lifecycle
-
+
def initialize(args)
set_attr_from_hash(args)
self.on_register
@@ -100,7 +100,13 @@ def send_control_message(message)
end
def stop
- send_control_message(:stop)
+ begin
+ send_control_message(:stop)
+ rescue Errno::EPIPE => e
+ # the remote end sometimes shuts down particularly quickly,
+ # causing us to get a failure from this message send which we
+ # may safely ignore
+ end
end
def child_stop
exit 0

0 comments on commit f5dbe28

Please sign in to comment.