[4.1] 13586c0 Dont panic because a housekeeping thread races against orderly shutdown.
Lasse Karstensen
lkarsten at varnish-software.com
Thu Feb 11 17:14:33 CET 2016
commit 13586c02912ea8eea777d0e20ada6e57f1cef52e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Feb 8 10:32:56 2016 +0000
Dont panic because a housekeeping thread races against orderly
shutdown.
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index a17351d..e983dca 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -506,8 +506,12 @@ vca_acct(void *arg)
while (1) {
(void)sleep(1);
if (vca_tcp_opt_init()) {
- VTAILQ_FOREACH(ls, &heritage.socks, list)
+ VTAILQ_FOREACH(ls, &heritage.socks, list) {
+ if (ls->sock == -2)
+ continue; // raced VCA_Shutdown
+ assert (ls->sock > 0);
vca_tcp_opt_set(ls->sock, 1);
+ }
}
now = VTIM_real();
VSC_C_main->uptime = (uint64_t)(now - t0);
@@ -581,7 +585,7 @@ VCA_Shutdown(void)
VTAILQ_FOREACH(ls, &heritage.socks, list) {
i = ls->sock;
- ls->sock = -1;
+ ls->sock = -2;
(void)close(i);
}
}
More information about the varnish-commit
mailing list