Objects for ESI includes incorrectly miss (Solved / Patch)

Poul-Henning Kamp phk at phk.freebsd.dk
Tue May 27 09:15:25 CEST 2008


Can you try this patch instead:


Index: cache_center.c
===================================================================
--- cache_center.c	(revision 2639)
+++ cache_center.c	(working copy)
@@ -234,7 +234,6 @@
 	sp->xid = 0;
 	SES_Charge(sp);
 	sp->t_open = sp->t_end;
-	sp->t_req = NAN;
 	sp->t_resp = NAN;
 	WSL_Flush(sp->wrk, 0);
 
@@ -242,6 +241,8 @@
 	if (sp->esis > 0)
 		return (1);
 
+	sp->t_req = NAN;
+
 	if (sp->fd >= 0 && sp->doclose != NULL)
 		vca_close_session(sp, sp->doclose);
 	if (sp->fd < 0) {



Poul-Henning


In message <4833000D.3010204 at endpoint.com>, JT Justman writes:
>This is a multi-part message in MIME format.
>--------------020006040805080601000507
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>Content-Transfer-Encoding: 7bit
>
>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
>
>--------------020006040805080601000507
>Content-Type: text/x-diff;
> name="cache_vrt_esi-jt_2008-05-20.patch"
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline;
> filename="cache_vrt_esi-jt_2008-05-20.patch"
>
>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)  {
>
>--------------020006040805080601000507
>Content-Type: text/plain; charset="us-ascii"
>MIME-Version: 1.0
>Content-Transfer-Encoding: 7bit
>Content-Disposition: inline
>
>_______________________________________________
>varnish-dev mailing list
>varnish-dev at projects.linpro.no
>http://projects.linpro.no/mailman/listinfo/varnish-dev
>
>--------------020006040805080601000507--
>

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-dev mailing list