[master] 36d69b3a3 expire thread: add vsl to wrk

Nils Goroll nils.goroll at uplex.de
Thu Aug 22 15:48:08 UTC 2024


commit 36d69b3a3dc90759afddcc9f7997f0bfd7552639
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Aug 22 17:44:02 2024 +0200

    expire thread: add vsl to wrk
    
    Seen when injecting errors with a custom storage engine: The ban lurker calls
    into the object API, and a storage engine might emit VSL.
    
    Assert error in vsl_sanity(), cache/cache_shmlog.c line 109:
      Condition((vsl) != 0) not true.
    
    Backtrace:
      ...
      ip=0x5570eb31ebc0 sp=0x7f40181ded90 <vsl_sanity+0x41>
      ip=0x5570eb31feee sp=0x7f40181dedb0 <VSLb+0x67>
      ip=0x7f4023cc5a75 sp=0x7f40181deeb0 <stvfe_fcr_handle+0xf5>
      ip=0x7f4023cc4727 sp=0x7f40181def40 <sfemem_getattr+0x167>
      ip=0x5570eb30b5f0 sp=0x7f40181deff0 <ObjGetAttr+0xef>
      ip=0x5570eb30bd5e sp=0x7f40181df030 <ObjGetU64+0x2e>
      ip=0x5570eb30bb8c sp=0x7f40181df070 <ObjGetXID+0x2c>
      ip=0x5570eb2f0617 sp=0x7f40181df0a0 <exp_inbox+0x2db>
      ip=0x5570eb2f1229 sp=0x7f40181df0e0 <exp_thread+0x397>
      ...

diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c
index 40362f109..ff1c04152 100644
--- a/bin/varnishd/cache/cache_expire.c
+++ b/bin/varnishd/cache/cache_expire.c
@@ -429,6 +429,8 @@ exp_thread(struct worker *wrk, void *priv)
 	CAST_OBJ_NOTNULL(ep, priv, EXP_PRIV_MAGIC);
 	ep->wrk = wrk;
 	VSL_Setup(&ep->vsl, NULL, 0);
+	AZ(wrk->vsl);
+	wrk->vsl = &ep->vsl;
 	ep->heap = VBH_new(NULL, object_cmp, object_update);
 	AN(ep->heap);
 	while (exp_shutdown == 0) {
@@ -460,6 +462,7 @@ exp_thread(struct worker *wrk, void *priv)
 		else
 			tnext = exp_expire(ep, t);
 	}
+	wrk->vsl = NULL;
 	return (NULL);
 }
 


More information about the varnish-commit mailing list