From c20d73733871ee820fe87880e076a00cbad1b7d6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 25 Jan 2018 07:28:37 +0100 Subject: [PATCH] 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. --- src/hathreads.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.3