]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MEDIUM: pollers: really create the poller pipes in builds without threads
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 18 Aug 2026 12:31:00 +0000 (14:31 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 18 Aug 2026 12:24:03 +0000 (14:24 +0200)
Commit c5f41118c ("BUG/MEDIUM: tasks: don't type-pun state and tid in
builds without threads") was mangled when committed: instead of the task
fix its message describes, its content accidentally reverted commit
cc0c18d82 ("BUG/MEDIUM: pollers: create the poller pipes in builds
without threads"), moving the fd_precreate_poller_pipes() call back into
setup_extra_threads(), an empty stub without threads. Builds made with
USE_THREAD unset (e.g. TARGET=generic) thus abort again on startup on
BUG_ON(fdtab[fd].owner) when inserting the poller pipes.

Move the call back to haproxy.c, right before setup_extra_threads(), so
that all builds share the same path.

src/haproxy.c
src/thread.c

index 37342900751b89fee1a5bd7926b94d41061a9aef..801bc6dfe734d3c94a55c8c02e63699f265cf347 100644 (file)
@@ -3946,6 +3946,18 @@ int main(int argc, char **argv)
                }
        }
 
+       /* When FD tables are not shared between thread groups, the poller
+        * pipes of all threads must be created before any group unshares its
+        * FD table, so that they are inherited into every group's table and
+        * cross-group wake_thread() keeps working. This must be done for all
+        * builds, including those without threads, since each thread will pick
+        * its own pair from there.
+        */
+       if (!fd_precreate_poller_pipes()) {
+               ha_alert("Failed to create the poller pipes.\n");
+               exit(1);
+       }
+
        /* start threads 2 and above */
        setup_extra_threads(&run_thread_poll_loop);
 
index 557af60fb9202222c15a201ea72471ff360d0d9b..3a6efe48264683aa4b7fe1989acefcda6991ac35 100644 (file)
@@ -278,16 +278,6 @@ void setup_extra_threads(void *(*handler)(void *))
        /* the startup thread will be thread 1 */
        ha_pthread[0] = pthread_self();
 
-       /* When FD tables are not shared between thread groups, the poller
-        * pipes of all threads must be created before any group unshares its
-        * FD table, so that they are inherited into every group's table and
-        * cross-group wake_thread() keeps working.
-        */
-       if (!fd_precreate_poller_pipes()) {
-               ha_alert("Failed to create the poller pipes.\n");
-               exit(1);
-       }
-
        /* Create one initial thread for each extra thread group. These will
         * each be responsible for creating their own extra threads. The first
         * group's initial thread is the current thread.