From: William Lallemand Date: Mon, 24 Jun 2019 15:40:48 +0000 (+0200) Subject: BUG/MEDIUM: mworker: don't call the thread and fdtab deinit X-Git-Tag: v2.1-dev1~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=16866670dd0fcb0dbb5d747a467feb008951be49;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: mworker: don't call the thread and fdtab deinit Before switching to wait mode, the per thread deinit should not be called, because we didn't initiate threads and fdtab. The problem is that the master could crash if we try to reload HAProxy The commit 944e619 ("MEDIUM: mworker: wait mode use standard init code path") removed the deinit code by accident, but its fix 7c756a8 ("BUG/MEDIUM: mworker: fix FD leak upon reload") was incomplete and did not took care of the WAIT_MODE. This fix must be backported in 1.9 and 2.0 --- diff --git a/src/haproxy.c b/src/haproxy.c index c3a448264f..617116c2b3 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -634,11 +634,14 @@ void mworker_reload() /* close the listeners FD */ mworker_cli_proxy_stop(); - /* close the poller FD and the thread waker pipe FD */ - list_for_each_entry(ptdf, &per_thread_deinit_list, list) - ptdf->fct(); - if (fdtab) - deinit_pollers(); + + if (getenv("HAPROXY_MWORKER_WAIT_ONLY") == NULL) { + /* close the poller FD and the thread waker pipe FD */ + list_for_each_entry(ptdf, &per_thread_deinit_list, list) + ptdf->fct(); + if (fdtab) + deinit_pollers(); + } #if defined(USE_OPENSSL) && (HA_OPENSSL_VERSION_NUMBER >= 0x10101000L) if (global.ssl_used_frontend || global.ssl_used_backend) /* close random device FDs */