mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-05 13:06:10 +02:00
BUG/MEDIUM: proxy: fix crash with stop_proxy() called during init
Willy reported that the following config would segfault right after the
"removing incomplete section 'peer' is emitted:
peers peers
bind :2300
server n10 127.0.0.1:2310
listen dummy
bind localhost:9999
This is caused by the fact that stop_proxy(), which tries to read shared
counters, is called during early init while shared counters are not yet
initialized. To fix the crash, let's check if we're still during starting
phase, in which case we assume the counters are not initialized and we
assume 0 value instead.
No backport needed unless 16eb0fab31 ("MAJOR: counters: dispatch counters
over thread groups") is.
This commit is contained in:
parent
6f9fccec1f
commit
9272b8ce74
10
src/proxy.c
10
src/proxy.c
@ -2137,10 +2137,12 @@ void proxy_cond_disable(struct proxy *p)
|
||||
* peers, etc) we must not report them at all as they're not really on
|
||||
* the data plane but on the control plane.
|
||||
*/
|
||||
if (p->cap & PR_CAP_FE)
|
||||
cum_conn = COUNTERS_SHARED_TOTAL(p->fe_counters.shared.tg, cum_conn, HA_ATOMIC_LOAD);
|
||||
if (p->cap & PR_CAP_BE)
|
||||
cum_sess = COUNTERS_SHARED_TOTAL(p->be_counters.shared.tg, cum_sess, HA_ATOMIC_LOAD);
|
||||
if (!(global.mode & MODE_STARTING)) {
|
||||
if (p->cap & PR_CAP_FE)
|
||||
cum_conn = COUNTERS_SHARED_TOTAL(p->fe_counters.shared.tg, cum_conn, HA_ATOMIC_LOAD);
|
||||
if (p->cap & PR_CAP_BE)
|
||||
cum_sess = COUNTERS_SHARED_TOTAL(p->be_counters.shared.tg, cum_sess, HA_ATOMIC_LOAD);
|
||||
}
|
||||
|
||||
if ((p->mode == PR_MODE_TCP || p->mode == PR_MODE_HTTP || p->mode == PR_MODE_SYSLOG || p->mode == PR_MODE_SPOP) && !(p->cap & PR_CAP_INT))
|
||||
ha_warning("Proxy %s stopped (cumulated conns: FE: %lld, BE: %lld).\n",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user