Commit
5f548bc8e ("MEDIUM: pollers: Create the poller pipes before we
create the thread") creates them from setup_extra_threads(), which is an
empty stub when built without threads (e.g. TARGET=generic). The pipes
then stay uninitialized and each thread inserts fd 0 twice, hitting
BUG_ON(fdtab[fd].owner != NULL) at boot.
Move the call to haproxy.c just before setup_extra_threads() so that all
builds share the same path.
}
}
+ /* 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);
/* 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.