Commit 19966c02 authored by Tollef Fog Heen's avatar Tollef Fog Heen

Merge r5102: Retry backend fetches

Retry backend fetches one time if we got a recycled connection and the
transfer failed before we received anything.

Fixes: #749


git-svn-id: http://www.varnish-cache.org/svn/branches/2.1@5313 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent f7a5d684
......@@ -442,6 +442,15 @@ cnt_fetch(struct sess *sp)
http_Setup(sp->wrk->beresp, sp->wrk->ws);
i = FetchHdr(sp);
/*
* If we recycle a backend connection, there is a finite chance
* that the backend closed it before we get a request to it.
* Do a single retry in that case.
*/
if (i == 1) {
VSL_stats->backend_retry++;
i = FetchHdr(sp);
}
/*
* Save a copy before it might get mangled in VCL. When it comes to
......
......@@ -152,3 +152,5 @@ MAC_STAT(esi_errors, uint64_t, 0, 'a', "ESI parse errors (unlock)")
MAC_STAT(accept_fail, uint64_t, 0, 'a', "Accept failures")
MAC_STAT(client_drop_late, uint64_t, 0, 'a', "Connection dropped late")
MAC_STAT(uptime, uint64_t, 0, 'a', "Client uptime")
MAC_STAT(backend_retry, uint64_t, 0, 'a', "Backend conn. retry")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment