JT Justman wrote:
Hi, everyone. I've been doing my best to dig into the bug I opened:

http://varnish.projects.linpro.no/ticket/240

Basically, every object is inserted, but the second and subsiquent objects always miss.

I have found the cause for the bug, and a potential fix.

In cache_hash.c function HSH_Lookup, there is a ttl check:

if (o->ttl >= sp->t_req)

This test passes on the first ESI and fails on the others. Debugging shows that the ttl is correct, but t_req is NAN. It seems that t_req is cleared, and needs to be reset somewhere in ESI or the step flow.

My solution is to set sp->t_req = TIM_real() in ESI_Deliver. (See patch).

Not being intimate with the program flow or timing, I don't know what other implications this could have. Suggestions?

JT
Index: cache_vrt_esi.c
===================================================================
--- cache_vrt_esi.c	(revision 2635)
+++ cache_vrt_esi.c	(working copy)
@@ -773,6 +773,8 @@
 		obj = sp->obj;
 		sp->obj = NULL;
 		*sp->http = *sp->http0;
+		if (isnan(sp->t_req))
+			sp->t_req = TIM_real();	
 		/* XXX: reset sp->ws */
 		http_SetH(sp->http, HTTP_HDR_URL, eb->include.b);
 		if (eb->host.b != NULL)  {
_______________________________________________
varnish-dev mailing list
varnish-dev@projects.linpro.no
http://projects.linpro.no/mailman/listinfo/varnish-dev

Reply via email to