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

TThreadedServer leaks per-thread memory

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Cannot Reproduce
    • 0.9.1
    • 0.9.3
    • C++ - Library
    • None
    • RHEL 6.5

    Description

      We are using Thrift 0.9.1 in Linux, both client and server are written in C++. TThreadedServer is used to process requests involving large (up to 1MB) binary parameters.

      Usage pattern is like this: the client establishes a UNIX socket connection, makes some interface calls and then disconnects.

      We noticed that the memory footprint of the server process increases over time. Valgrind inspection showed that despite the server threads have long been shutdown, their data allocated in TThreadedServer::serve() hasn't been freed and shows up as "definitely lost".

      This leak, although significant, is not critical by itself. But per-thread data includes a TBinaryProtocol object, which in turn holds a "string buffer" used to serialize binary parameters. These string buffers are quite large in our case, leading to overall memory leakage being unacceptably high.

      As a workaround, we will for now turn to TNonblockingServer, which uses persistent threads. However, a memory leak is still a very serious problem, and it should be fixed.

      Attachments

        1. thrift_vg.txt
          26 kB
          Artem Koval

        Activity

          People

            jking3 James E. King III
            turbonomad Artem Koval
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: