qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Schlauch (JIRA)" <qpid-...@incubator.apache.org>
Subject [jira] Commented: (QPID-2368) Exception Thrown at qpid/sys/epoll/EpollPoller.cpp:254 Leaves Orphan File Descriptor
Date Mon, 01 Feb 2010 21:52:18 GMT

    [ https://issues.apache.org/jira/browse/QPID-2368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12828286#action_12828286
] 

Jason Schlauch commented on QPID-2368:
--------------------------------------

How about:

try {
QPID_POSIX_CHECK(::epoll_ctl(epollFd, EPOLL_CTL_ADD, alwaysReadableFd, &epe)); 
} catch (...) {
   close(epollFd);
   throw;
}

> 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
>            Priority: Minor
>
> 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:dev-subscribe@qpid.apache.org


Mime
View raw message