Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-1149

Nonblocking server fails when client connection is reset

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.6
    • 0.7
    • Ruby - Library
    • 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 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.

      Attachments

        1. nonblocking_fix.diff
          0.8 kB
          Alex

        Activity

          People

            centromere Alex
            centromere Alex
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: