[zeromq-dev] setting the CLOEXEC flag for eventfd and epoll instances?

Luca Boccassi luca.boccassi at gmail.com
Fri Dec 2 15:00:12 CET 2016


Makes sense, we already set the CLOEXEC flag in the sockets.

Given it's causing you issues, would you be able to test it and send a
PR to fix it? Thanks!

On Fri, 2016-12-02 at 14:19 +0100, zmqdev wrote:
> 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);
> 
> 
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161202/ea6e2232/attachment.sig>


More information about the zeromq-dev mailing list