Unverified Commit d3b6409e authored by Emanuele Rocca's avatar Emanuele Rocca Committed by Nils Goroll

vbf_stp_condfetch: handle storage error instead of crashing

Fixes: #3273
parent 3e5d5f29
......@@ -733,7 +733,12 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
AZ(stale_boc);
AZ(bo->stale_oc->flags & OC_F_FAILED);
AZ(vbf_beresp2obj(bo));
if (vbf_beresp2obj(bo)) {
(void)VFP_Error(bo->vfc, "Could not get storage in vbf_stp_condfetch");
vbf_cleanup(bo);
wrk->stats->fetch_failed++;
return (F_STP_FAIL);
}
if (ObjHasAttr(bo->wrk, bo->stale_oc, OA_ESIDATA))
AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc,
......
varnishtest "vbf_stp_condfetch could not get storage #3273"
server s1 {
rxreq
expect req.url == "/transient"
txresp -bodylen 1048400
rxreq
expect req.url == "/malloc"
txresp -hdr "Cache-Control: max-age=2" -hdr "Last-Modified: Fri, 03 Apr 2020 13:00:01 GMT" -bodylen 1048300
rxreq
expect req.http.If-Modified-Since == "Fri, 03 Apr 2020 13:00:01 GMT"
expect req.url == "/malloc"
txresp -status 304
} -start
varnish v1 \
-arg "-s Transient=default,1m" \
-arg "-s malloc,1m" \
-arg "-p nuke_limit=0" \
-syntax 4.0 \
-vcl+backend {
sub vcl_backend_response {
if (bereq.url == "/transient") {
set beresp.storage = storage.Transient;
# Unset Date header to not change the object sizes
unset beresp.http.Date;
}
}
} -start
varnish v1 -cliok "param.set debug +syncvsl"
delay .1
client c1 {
# Fill transient
txreq -url "/transient"
rxresp
expect resp.status == 200
} -run
delay .1
varnish v1 -expect SM?.Transient.g_bytes > 1048000
varnish v1 -expect SM?.Transient.g_space == 8
client c1 {
# Fill malloc
txreq -url "/malloc" -hdr "If-Modified-Since: Fri, 03 Apr 2020 12:00:01 GMT"
rxresp
expect resp.status == 200
delay 3
} -run
varnish v1 -expect SM?.s0.g_bytes > 1048000
varnish v1 -expect SM?.s0.g_space == 4
client c1 {
# Check that Varnish is still alive
txreq -url "/malloc" -hdr "If-Modified-Since: Fri, 03 Apr 2020 12:00:01 GMT"
rxresp
expect resp.status == 200
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment