Exception Thrown at qpid/sys/epoll/EpollPoller.cpp:254 Leaves Orphan File
Descriptor
------------------------------------------------------------------------------------
Key: QPID-2368
URL: https://issues.apache.org/jira/browse/QPID-2368
Project: Qpid
Issue Type: Bug
Components: C++ Client
Affects Versions: 0.5
Environment: c++ client
Reporter: Jason Schlauch
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]