Skip to content

Commit

Permalink
Avoid panic if director is already finalized for invalid range after …
Browse files Browse the repository at this point in the history
…rollback

Fixes #4164
  • Loading branch information
nigoroll committed Aug 16, 2024
1 parent 808a8dd commit 3eec7e8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/varnishd/cache/cache_fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
bo->htc->doclose = SC_RESP_CLOSE;

if (VRG_CheckBo(bo) < 0) {
VDI_Finish(bo);
if (bo->director_state != DIR_S_NULL)
VDI_Finish(bo);
return (F_STP_ERROR);
}

Expand Down
26 changes: 26 additions & 0 deletions bin/varnishtest/tests/r04164.vtc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
varnishtest "pass, rollback, invalid range"

server s1 {
rxreq
expect req.url == "/baz"
txresp -status 400
} -start

varnish v1 -vcl+backend {
import std;

sub vcl_recv {
return (pass);
}
sub vcl_backend_response {
std.rollback(bereq);
return (retry);
}
} -start

client c1 {
txreq -url "/baz" -hdr "range: 42"
rxresp
} -run

server s1 -wait

0 comments on commit 3eec7e8

Please sign in to comment.