[PATCH 07/25] Don't free the object store when fetch fails and streaming is in effect, as there might be threads reading this data.

Martin Blix Grydeland martin at varnish-software.com
Sun Jan 22 18:53:13 CET 2012


---
 bin/varnishd/cache/cache_fetch.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index b9e7ef0..f69d80f 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -580,11 +580,14 @@ FetchBody(struct worker *wrk, struct busyobj *bo)
 
 	if (cls < 0) {
 		wrk->stats.fetch_failed++;
-		/* XXX: Wouldn't this store automatically be released ? */
-		while (!VTAILQ_EMPTY(&obj->store)) {
-			st = VTAILQ_FIRST(&obj->store);
-			VTAILQ_REMOVE(&obj->store, st, list);
-			STV_free(st);
+		if (bo->do_stream == 0) {
+			/* XXX: Wouldn't this store automatically be
+			 * released ? */
+			while (!VTAILQ_EMPTY(&obj->store)) {
+				st = VTAILQ_FIRST(&obj->store);
+				VTAILQ_REMOVE(&obj->store, st, list);
+				STV_free(st);
+			}
 		}
 		VDI_CloseFd(wrk, &bo->vbc);
 		obj->len = 0;
-- 
1.7.4.1




More information about the varnish-dev mailing list