• delthas's avatar
    vbe: Update the poll timeout before polling-reading in backend probes · 4e7d6633
    delthas authored
    Varnish uses a global per-probe timeout for backend probes. When reading
    the backend response, Varnish tries to poll and read in a loop, until a
    poll timeouts, the streams EOFs or there is an error.
    
    The poll is supposed to timeout when the per-probe timeout ends. This is
    currently setup so that `t_end` is the deadline for the probe, set when
    the function starts, then the poll waits until `t_end`.
    
    Previously, the poll timeout was never updated, and was always set to
    `t_end - t_now` without updating `t_now`, which means that it was
    effectively a between-bytes timeout instead of a proper per-probe
    timeout.
    
    This fixes this issue by updating `t_now` before updating the
    `t_end - t_now` timeout so that the timeout passed to poll effectively
    corresponds to a deadline of `t_end`.
    
    See the issue fixed by this commit for more details.
    
    Fixes: #3402
    4e7d6633
cache_backend_probe.c 16.7 KB