Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The opposite of 'EXP_Ttl(req, oc) > req->t_req' should not have been 'EXP_Ttl(NULL, oc) < req->t_req'. If we somehow enter the lookup when the two operands are equal, the objcore suffers a phenomenon known as Schrödinger's expiry. The chances of running into this scenario range from epsilon to 100%. Because 't_req' is stable across restarts, a soft purge will reliably trigger this case. Test case by Alve Elde who first demonstrated the problem.
- Loading branch information
Showing
2 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
varnishtest "304 revalidations with purge.soft()" | ||
|
||
server s1 { | ||
rxreq | ||
txresp -hdr "etag: foo" -body "foo" | ||
|
||
rxreq | ||
expect req.http.If-None-Match == "foo" | ||
txresp -status 304 -hdr "etag: foo" | ||
} -start | ||
|
||
varnish v1 -vcl+backend { | ||
import purge; | ||
|
||
sub vcl_hit { | ||
if (req.restarts == 0) { | ||
purge.soft(); | ||
return (restart); | ||
} | ||
} | ||
|
||
sub vcl_backend_response { | ||
set beresp.ttl = 1d; | ||
set beresp.grace = 1d; | ||
set beresp.keep = 1d; | ||
} | ||
} -start | ||
|
||
client c1 { | ||
txreq | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.body == "foo" | ||
|
||
txreq | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.body == "foo" | ||
} -run |