[6.0] 9e6ec423f Release wrk->vcl before (potentially) long-running worker jobs which do not need it (acceptor, h2_sess)
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Feb 12 13:28:10 UTC 2019
commit 9e6ec423f67ff3840ea76200abd9d7b87a558190
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Dec 10 09:22:04 2018 +0000
Release wrk->vcl before (potentially) long-running worker jobs which do
not need it (acceptor, h2_sess)
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index b05a53a59..fb37ad574 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -460,6 +460,10 @@ vca_accept_task(struct worker *wrk, void *arg)
while (!pool_accepting)
VTIM_sleep(.1);
+ /* Dont hold on to (possibly) discarded VCLs */
+ if (wrk->vcl != NULL)
+ VCL_Rel(&wrk->vcl);
+
while (!ps->pool->die) {
INIT_OBJ(&wa, WRK_ACCEPT_MAGIC);
wa.acceptlsock = ls;
@@ -535,12 +539,6 @@ vca_accept_task(struct worker *wrk, void *arg)
if (!ps->pool->die && DO_DEBUG(DBG_SLOW_ACCEPTOR))
VTIM_sleep(2.0);
- /*
- * We were able to hand off, so release this threads VCL
- * reference (if any) so we don't hold on to discarded VCLs.
- */
- if (wrk->vcl != NULL)
- VCL_Rel(&wrk->vcl);
}
}
diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index ce114d390..246400de7 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -345,6 +345,9 @@ h2_new_session(struct worker *wrk, void *arg)
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ if (wrk->vcl)
+ VCL_Rel(&wrk->vcl);
+
assert(req->transport == &H2_transport);
assert (req->err_code == H2_PU_MARKER || req->err_code == H2_OU_MARKER);
More information about the varnish-commit
mailing list