[experimental-ims] 2da6772 Remember to sleep and terminate, rather than loop for ever on a zero VSL record. Still not quite sure how they happen, but we shouldn't hang no matter what.

Geoff Simmons geoff at varnish-cache.org
Mon Jan 9 21:52:00 CET 2012


commit 2da67725c55a9aa1c7719048b5bb9642129f0dcf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Sep 20 14:31:44 2011 +0000

    Remember to sleep and terminate, rather than loop for ever on a zero
    VSL record.  Still not quite sure how they happen, but we shouldn't hang
    no matter what.

diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 848fe65..1bc46dd 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -175,6 +175,8 @@ vsl_nextlog(struct vsl *vsl, uint32_t **pp)
 
 		if (t == 0) {
 			/* Zero-initialized VSL */
+			w += SLEEP_USEC;
+			assert(usleep(SLEEP_USEC) == 0 || errno == EINTR);
 			VRMB();
 			continue;
 		}
@@ -197,6 +199,7 @@ vsl_nextlog(struct vsl *vsl, uint32_t **pp)
 				return (-1);
 			w += SLEEP_USEC;
 			assert(usleep(SLEEP_USEC) == 0 || errno == EINTR);
+			VRMB();
 			continue;
 		}
 		if (vsl->log_ptr == vsl->log_start + 1)



More information about the varnish-commit mailing list