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

don't exit(-1) in TNonblockingServer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.8
    • 0.9
    • C++ - Library
    • None
    • Patch Available

    Description

      TNonblockingServer calls exit(-1) when it encounters a std::bad_alloc exception. The -1 argument to exit() is problematic. Programs typically use non-zero exit codes since negative values are reserved for signals. On somewhat modern Linux (CentOS 6.0), exit(-1) causes the process to yield return code 255. which BASH claims is out of range:
      http://tldp.org/LDP/abs/html/exitcodes.html

      I don't see any advantage to exit(-1) in this case. If the intent is to exit with an error indication, 1 (or the EXIT_FAILURE macro) should do fine. If the intent is to signal program termination, possibly with a stack trace, abrt() would be better.

      Attached is a patch for the simplest change from '-1' to '1'.

      Thanks.

      Attachments

        1. 1689.patch
          0.7 kB
          Brian Fallik

        Activity

          People

            bfallik-aereo Brian Fallik
            bfallik-aereo Brian Fallik
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: