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

event_base memory freeing by class TNonblockingServer

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • C++ - Library
    • Patch Available

    Description

      The TNonblockingServer::eventBase_ pointer is assigned
      by method TNonblockingServer::registerEvents()
      so the libevent events are added to the proper libevent event base.

      Currently the TNonblockingServer destructor unconditionally
      calls event_base_free(eventBase_) to free the eventBase_ memory.

      In certain cases the libevent event base might be allocated and
      deallocated by a third-party software that uses Thrift, so it is
      not appropriate for the TNonblockingServer destructor to unconditionally
      call event_base_free(eventBase_).

      Please see attached patch for a possible solution:
      add an optional bool argument to method TNonblockingServer::registerEvents():
      the value of that flag controls whether the TNonblockingServer destructor
      should call event_base_free(eventBase_).

      The argument is optional, and defaults to true (i.e, event_base_free(eventBase_)
      is called) for API (and behavior) backward compatibility.

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            pavlin Pavlin Radoslavov
            pavlin Pavlin Radoslavov
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment