]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: threads: always set an owner to the thread_sync pipe
authorWilly Tarreau <w@1wt.eu>
Thu, 25 Jan 2018 06:28:37 +0000 (07:28 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Jan 2018 06:31:08 +0000 (07:31 +0100)
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

index 50f3c77011d90bf6e5d19742d470fa37c2782c4a..fea4ffeb0b959479296dfe5ee1afcadd3a79035c 100644 (file)
@@ -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);