[Varnish] #1156: first_byte_timeout is "doubled" on the client side when keep-alive is used

Varnish varnish-bugs at varnish-cache.org
Mon Jun 18 16:28:01 CEST 2012


#1156: first_byte_timeout is "doubled" on the client side when keep-alive is used
-------------------+--------------------------------------------------------
 Reporter:  tnt    |        Type:  defect  
   Status:  new    |    Priority:  normal  
Milestone:         |   Component:  varnishd
  Version:  trunk  |    Severity:  normal  
 Keywords:         |  
-------------------+--------------------------------------------------------

Comment(by tnt):

 A bit more investigation turned some more infos:

  - The request is actually retried on a new backend connection, which is
 why it takes twice as much time
  - It doesn't happen on the first connection because there is no 'retry'
 for fresh new backend connections.

 What happens is that the code that retries request to a backend in case of
 keepalive (like is the backend closes the connection) decides to retry the
 request ... But that's not an acceptable behavior for a 'timeout' error,
 only for things like connection reset or if the request couldn't be sent
 but not timeout on the response.

 To check if this was really the source of the problem I tried this hack:

 {{{
 diff --git a/bin/varnishd/cache/cache_fetch.c
 b/bin/varnishd/cache/cache_fetch.c
 index 7ccba0a..f71cd45 100644
 --- a/bin/varnishd/cache/cache_fetch.c
 +++ b/bin/varnishd/cache/cache_fetch.c
 @@ -510,7 +510,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int
 sendbody)
                 VDI_CloseFd(&bo->vbc);
                 /* XXX: other cleanup ? */
                 /* Retryable if we never received anything */
 -               return (i == -1 ? retry : -1);
 +               return -1;
         }

         VTCP_set_read_timeout(vc->fd, vc->between_bytes_timeout);
 }}}

 (It's obviously not a 'fix' because it disables retry in all cases but
 that was just to confirm the source of the issue).

 Ideally we'd need to know if HTC_Rx timed out or had a real error.

-- 
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1156#comment:3>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list