zmqdev
2016-12-02 13:19:43 UTC
while investigating a problem involving fork() and zeromq, I found some
file descriptor leaks.
1. The function
zmq::epoll_t::epoll_t (const zmq::ctx_t &ctx_)
in src/epoll.cpp creates an epoll instance with
epoll_fd = epoll_create(1);
SUGGESTION: replace with
epoll_fd = epoll_create1(EPOLL_CLOEXEC);
2. The function
zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
in src/signaler.cpp creates an eventfd object with
#if defined ZMQ_HAVE_EVENTFD
fd_t fd = eventfd (0, 0);
SUGGESTION: replace with
#if defined ZMQ_HAVE_EVENTFD
fd_t fd = eventfd (0, EFD_CLOEXEC);
file descriptor leaks.
1. The function
zmq::epoll_t::epoll_t (const zmq::ctx_t &ctx_)
in src/epoll.cpp creates an epoll instance with
epoll_fd = epoll_create(1);
SUGGESTION: replace with
epoll_fd = epoll_create1(EPOLL_CLOEXEC);
2. The function
zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
in src/signaler.cpp creates an eventfd object with
#if defined ZMQ_HAVE_EVENTFD
fd_t fd = eventfd (0, 0);
SUGGESTION: replace with
#if defined ZMQ_HAVE_EVENTFD
fd_t fd = eventfd (0, EFD_CLOEXEC);