You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2011/04/18 19:29:06 UTC

svn commit: r1094667 - /thrift/trunk/lib/rb/lib/thrift/server/nonblocking_server.rb

Author: bryanduxbury
Date: Mon Apr 18 17:29:06 2011
New Revision: 1094667

URL: http://svn.apache.org/viewvc?rev=1094667&view=rev
Log:
THRIFT-1149. ruby: Nonblocking server fails when client connection is reset

In some situations, a disconnecting client could cause the nonblocking server to trip on an exception and take the whole server down. This patch rescues such errors and cleans up only the disconnected client.

Patch: Alex

Modified:
    thrift/trunk/lib/rb/lib/thrift/server/nonblocking_server.rb

Modified: thrift/trunk/lib/rb/lib/thrift/server/nonblocking_server.rb
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/rb/lib/thrift/server/nonblocking_server.rb?rev=1094667&r1=1094666&r2=1094667&view=diff
==============================================================================
--- thrift/trunk/lib/rb/lib/thrift/server/nonblocking_server.rb (original)
+++ thrift/trunk/lib/rb/lib/thrift/server/nonblocking_server.rb Mon Apr 18 17:29:06 2011
@@ -146,10 +146,14 @@ module Thrift
             break if read_signals == :shutdown
           end
           rd.each do |fd|
-            if fd.handle.eof?
+            begin
+              if fd.handle.eof?
+                remove_connection fd
+              else
+                read_connection fd
+              end
+            rescue Errno::ECONNRESET
               remove_connection fd
-            else
-              read_connection fd
             end
           end
         end
@@ -292,4 +296,4 @@ module Thrift
       end
     end
   end
-end
\ No newline at end of file
+end