Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-2368

Exception Thrown at qpid/sys/epoll/EpollPoller.cpp:254 Leaves Orphan File Descriptor

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 0.5
    • None
    • C++ Client
    • c++ client

    Description

      While researching JIRA QPID-2367 I noticed a pileup of file descriptors in /proc/PID/fd. I traced the creation of these descriptors back to this chunk of code in qpid/sys/epoll/EpollPoller.cpp:

      244 PollerPrivate() :
      245 epollFd(::epoll_create(DefaultFds)),
      246 isShutdown(false)

      { 247 QPID_POSIX_CHECK(epollFd); 248 ::sigemptyset(&sigMask); 249 // Add always readable fd into our set (but not listening to it yet) 250 ::epoll_event epe; 251 epe.events = 0; 252 epe.data.u64 = 0; 253 QPID_POSIX_CHECK(::epoll_ctl(epollFd, EPOLL_CTL_ADD, alwaysReadableFd, &epe)); 254 }

      The problem is with the second QPID_POSIX_CHECK – a macro that throws an exception. If an exception is thrown then the file descriptor allocated by epollFd(::epoll_create(DefaultFds)) is left dangling. A ::close(epollFd) would be needed in the catch() block to free it.

      There are a number of functions with a similar design in EpollPoller.cpp that might be similarly affected.

      Attachments

        Activity

          People

            astitcher Andrew Stitcher
            superjdynamite Jason Schlauch
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: