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

As an implementer of a perl socket server, I do not want to have to remember to ignore SIGCHLD for it to work properly

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.8, 0.9, 0.9.1, 0.9.2, 0.9.3
    • Fix Version/s: 0.10.0
    • Component/s: Perl - Library
    • Labels:
      None
    • Environment:

      Ubuntu 14.04, perl forking server, C++ client

      Description

      In a project I work on, we use a perl thrift server as a mock to simulate something in production. A C++ client connects, makes a call, and disconnects. The perl server is a forking server.

      I found that if I do not explicity ignore SIGCHLD, I can accept one connection and process it, but when it disconnects, the subsequent accept call is interrupted by a SIGCHLD and results in a useless handle that can_read says cannot be read. This puts Server.pm into an infinite accept/read/fail loop. The serve() method of the ForkingServer needs to explicitly ignore SIGCHLD to work properly.

      I've observed this behavior as far back as thrift-0.8.0 up through 0.9.3.

      The workaround is to add the following code before calling serve():

      $SIG{CHLD} = 'IGNORE';

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jking3 James E. King III
                Reporter:
                jking3 James E. King III
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: