Opened 11 years ago
Closed 11 years ago
#6005 closed Bugs (invalid)
Potential epoll fd leak in boost::asio::detail::epoll_reactor
Reported by: | Owned by: | chris_kohlhoff | |
---|---|---|---|
Milestone: | To Be Determined | Component: | asio |
Version: | Boost 1.40.0 | Severity: | Problem |
Keywords: | asio linux epoll fd leak | Cc: |
Description
in boost/asio/detail/impl/epoll_reactor.ipp:
epoll_reactor::epoll_reactor(boost::asio::io_service& io_service)
: boost::asio::detail::service_base<epoll_reactor>(io_service),
io_service_(use_service<io_service_impl>(io_service)), mutex_(), epoll_fd_(do_epoll_create()), ------> epoll_fd_ may leak if the following member's initialization throws an exception timer_fd_(do_timerfd_create()), interrupter_(), ------> may throw because of EMFILE shutdown_(false)
{
Add the interrupter's descriptor to epoll. epoll_event ev = { 0, { 0 } }; ev.events = EPOLLIN | EPOLLERR | EPOLLET; ev.data.ptr = &interrupter_; epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); interrupter_.interrupt();
Add the timer descriptor to epoll. if (timer_fd_ != -1) {
ev.events = EPOLLIN | EPOLLERR; ev.data.ptr = &timer_fd_; epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev);
}
}
Attachments (1)
Change History (3)
by , 11 years ago
Attachment: | epoll_reactor.hpp.patch_1.40.0 added |
---|
comment:1 by , 11 years ago
Version: | Boost 1.47.0 → Boost 1.40.0 |
---|
my patch only works, but it may not be the boost way and not graceful enough.
comment:2 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
only for boost 1.40.0