[master] 39e5492 The storage element may be empty on fetch fail

Martin Blix Grydeland martin at varnish-software.com
Mon Jan 16 16:00:06 CET 2017


commit 39e5492b191e6b8c4f84d9d18e118c22a236cad3
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Mon Jan 16 14:55:36 2017 +0100

    The storage element may be empty on fetch fail
    
    A failed fetch won't have the storage trimmed, which may result in an
    empty storage element in the body list. Do not assert on non-empty
    size in the simple iterator.
    
    Fixes: #2186

diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c
index 584da81..011b9ec 100644
--- a/bin/varnishd/storage/storage_simple.c
+++ b/bin/varnishd/storage/storage_simple.c
@@ -260,8 +260,7 @@ sml_iterator(struct worker *wrk, struct objcore *oc,
 
 	if (boc == NULL) {
 		VTAILQ_FOREACH_SAFE(st, &obj->list, list, checkpoint) {
-			AN(st->len);
-			if (ret == 0)
+			if (ret == 0 && st->len > 0)
 				ret = func(priv, 1, st->ptr, st->len);
 			if (final) {
 				VTAILQ_REMOVE(&obj->list, st, list);



More information about the varnish-commit mailing list