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

readBufferBytesAllocated in TNonblockingServer.java should be AtomicLong to fix FD leakage and general server malfunction

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.6
    • 0.7
    • Java - Library
    • None
    • Any

    • Patch Available

    Description

      We're having a problem using THsHaServer where the server suddenly stops closing connections and runs out of file descriptors.

      It looks like the problem is in TNonblockingServer.java. The variable "long readBufferBytesAllocated" is shared between threads but isn't synchronized. Intermittently, its value can get out of whack due to races and cause this if statement to always execute:

      // if this frame will push us over the memory limit, then return.
      // with luck, more memory will free up the next time around.
      if (readBufferBytesAllocated.get() + frameSize > MAX_READ_BUFFER_BYTES)

      { return true; }

      We started having this problem when we set MAX_READ_BUFFER_BYTES to a somewhat small size, which unmasked the issue.

      Attachments

        1. thrift.patch
          2 kB
          Tom May

        Activity

          People

            tommay Tom May
            tommay Tom May
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: