From: Willy Tarreau Date: Thu, 25 Jan 2018 06:28:37 +0000 (+0100) Subject: BUG/MINOR: threads: always set an owner to the thread_sync pipe X-Git-Tag: v1.9-dev1~498 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c20d73733871ee820fe87880e076a00cbad1b7d6;p=thirdparty%2Fhaproxy.git BUG/MINOR: threads: always set an owner to the thread_sync pipe The owner of the fd used by the synchronization pipe was set to NULL, making it ignored by maxfd computation. The risk would be that some synchronization events get delayed between threads when using poll() or select(). However this is only theorical since the pipe is created before listeners are bound so normally its FD should be lower and this should normally not happen. The only possible situation would be if all listeners are bound to inherited FDs which are lower than the pipe's. This patch must be backported to 1.8. --- diff --git a/src/hathreads.c b/src/hathreads.c index 50f3c77011..fea4ffeb0b 100644 --- a/src/hathreads.c +++ b/src/hathreads.c @@ -49,7 +49,7 @@ int thread_sync_init(unsigned long mask) rfd = threads_sync_pipe[0]; fcntl(rfd, F_SETFL, O_NONBLOCK); - fdtab[rfd].owner = NULL; + fdtab[rfd].owner = thread_sync_io_handler; fdtab[rfd].iocb = thread_sync_io_handler; fd_insert(rfd, MAX_THREADS_MASK);