Thrift
  1. Thrift
  2. THRIFT-1149

Nonblocking server fails when client connection is reset

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.6
    • Fix Version/s: 0.7
    • Component/s: Ruby - Library
    • Labels:
    • Environment:

      FreeBSD orion 8.2-RELEASE FreeBSD 8.2-RELEASE #19 r220462: Fri Apr 8 22:24:26 EDT 2011 alex@orion:/usr/obj/usr/src/sys/ORION amd64
      Ruby 1.9.2

    • Patch Info:
      Patch Available

      Description

      I've attempted to stress test the nonblocking server by writing a client which connects to said server and executes three operations as fast as possible in an infinite loop. I've found that if I kill the client (ctrl + C), an intermittent problem occurs where the server will stop accepting new connections from clients. In the case of multiple clients already connected, they are immediately disconnected.

      I've tracked the bug down to the run method in nonblocking_server.rb, specifically the "if fd.handle.eof?" statement (around line 150). Under certain conditions executing this line will cause Errno::ECONNRESET to be raised. As such, the "@shutdown_queue.push :shutdown" statement is executed, which accounts for the behavior I am seeing. The attached patch rescues such an error and removes the connection. I am not sure if this is the best way to do it, however it solves the problem for me.

        Activity

        Hide
        Hudson added a comment -

        Integrated in Thrift #129 (See https://hudson.apache.org/hudson/job/Thrift/129/)
        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

        Show
        Hudson added a comment - Integrated in Thrift #129 (See https://hudson.apache.org/hudson/job/Thrift/129/ ) 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
        Hide
        Bryan Duxbury added a comment -

        I just committed this. Thanks for the patch, Alex!

        Show
        Bryan Duxbury added a comment - I just committed this. Thanks for the patch, Alex!

          People

          • Assignee:
            Alex
            Reporter:
            Alex
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development