[4.0] 887c70e Delay HSH_Complete() until the storage sanity functions has finished.

Martin Blix Grydeland martin at varnish-software.com
Mon Nov 10 16:51:08 CET 2014


commit 887c70e64516136121d9a7492aab85c18054fd55
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Nov 10 16:49:45 2014 +0100

    Delay HSH_Complete() until the storage sanity functions has finished.
    
    This fixes a race where the client started freeing the body (which it
    does in the case of new hit-for-pass object being inserted) before the
    sanity functions were run.
    
    Fixes: #1596

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index a07d6e6..d24bfff 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -829,7 +829,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 
 	if (bo->state == BOS_FINISHED) {
 		AZ(bo->fetch_objcore->flags & OC_F_FAILED);
-		HSH_Complete(bo->fetch_objcore);
 		VSLb(bo->vsl, SLT_Length, "%zd", bo->fetch_obj->len);
 		{
 		/* Sanity check fetch methods accounting */
@@ -846,6 +845,7 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
 			else
 				assert(uu == bo->fetch_obj->len);
 		}
+		HSH_Complete(bo->fetch_objcore);
 	}
 	AZ(bo->fetch_objcore->busyobj);
 



More information about the varnish-commit mailing list