From: Willy Tarreau Date: Wed, 24 Feb 2021 10:13:59 +0000 (+0100) Subject: BUG/MINOR: proxy: wake up all threads when sending the hard-stop signal X-Git-Tag: v2.4-dev10~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0d03825b93cc59a289e838105f9d83d53ccdfc8b;p=thirdparty%2Fhaproxy.git BUG/MINOR: proxy: wake up all threads when sending the hard-stop signal The hard-stop event didn't wake threads up. In the past it wasn't an issue as the poll timeout was limited to 1 second, but since commit 4f59d3861 ("MINOR: time: increase the minimum wakeup interval to 60s") it has become a problem because old processes can remain live for up to one minute after the hard-stop-after delay. Let's just wake them up. This may be backported to older releases, though before 2.4 the extra delay was only one second. --- diff --git a/src/proxy.c b/src/proxy.c index 3e3d7cc23e..ea7fc7f6f6 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -1612,11 +1612,15 @@ struct task *hard_stop(struct task *t, void *context, unsigned short state) { struct proxy *p; struct stream *s; + int thr; if (killed) { ha_warning("Some tasks resisted to hard-stop, exiting now.\n"); send_log(NULL, LOG_WARNING, "Some tasks resisted to hard-stop, exiting now.\n"); killed = 2; + for (thr = 0; thr < global.nbthread; thr++) + if (((all_threads_mask & ~tid_bit) >> thr) & 1) + wake_thread(thr); t->expire = TICK_ETERNITY; return t; }