[Varnish] #1500: Possible bug in 4.0.0 with Range+do_stream=true

Varnish varnish-bugs at varnish-cache.org
Mon May 12 09:15:48 CEST 2014


#1500: Possible bug in 4.0.0 with Range+do_stream=true
-------------------------+--------------------
 Reporter:  moseleymark  |       Owner:
     Type:  defect       |      Status:  new
 Priority:  normal       |   Milestone:
Component:  build        |     Version:  4.0.0
 Severity:  normal       |  Resolution:
 Keywords:               |
-------------------------+--------------------

Comment (by phk):

 I was sort of vaguely aware of this, and left the code as is for lack of
 any better ideas.

 The basic problem is that a ranged response must commit to how many bytes
 it will send in the Content-Range response header.

 You report is on the low end of the range, but it's even more icky for an
 object with an unbounded upper end.

 Say you ask for the range "200-".  At the time we process the Range
 header, we have received 5k of the 1M object, so even if the low end
 clears fine, the high end truncates to 5k, returning you a response you
 can most likely not use.

 The only solid & correct way to work around this issue, would be to
 postpone the response until we have seen enough of the object from the
 backend to know how we can satisfy both ends of the range request, but
 that seems counter productive from a response-time point of view, as we'd
 have to wait for the full 1M object before starting to respond from byte
 200 onwards.

 A more heuristic handling would reply optimistically to the range request,
 setting Content-Range based on the range request, and fail the client
 connection if that optimism was unfounded.  That of course only works for
 range requests with a finite end.

 So all in all, I don't see any solutions significantly better than the
 present one.

 One possible workaround, would be a VMOD.std function you could call in
 vcl_response{} which looks for a range request and waits for the streaming
 from the backend until that range request can be properly processed.

 More when we have talked about this ticket at todays bugwash.

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



More information about the varnish-bugs mailing list