Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
dba9daad
Commit
dba9daad
authored
Dec 16, 2014
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle template object failures during condfetch
Fixes: #1648
parent
298ffb63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
1 deletion
+82
-1
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+7
-1
r01648.vtc
bin/varnishtest/tests/r01648.vtc
+75
-0
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
dba9daad
...
...
@@ -709,6 +709,8 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
oi
=
ObjIterBegin
(
wrk
,
bo
->
ims_oc
);
do
{
ois
=
ObjIter
(
bo
->
ims_oc
,
oi
,
&
sp
,
&
sl
);
if
(
ois
==
OIS_ERROR
)
VFP_Error
(
bo
->
vfc
,
"Template object failed"
);
while
(
sl
>
0
)
{
l
=
ObjGetLen
(
bo
->
wrk
,
bo
->
ims_oc
)
-
al
;
assert
(
l
>
0
);
...
...
@@ -724,8 +726,12 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
}
}
while
(
!
bo
->
vfc
->
failed
&&
(
ois
==
OIS_DATA
||
ois
==
OIS_STREAM
));
ObjIterEnd
(
bo
->
ims_oc
,
&
oi
);
if
(
bo
->
vfc
->
failed
)
if
(
bo
->
ims_oc
->
flags
&
OC_F_FAILED
)
VFP_Error
(
bo
->
vfc
,
"Template object failed"
);
if
(
bo
->
vfc
->
failed
)
{
VDI_Finish
(
bo
->
director_resp
,
bo
->
wrk
,
bo
);
return
(
F_STP_FAIL
);
}
if
(
!
bo
->
do_stream
)
HSH_Unbusy
(
wrk
,
bo
->
fetch_objcore
);
...
...
bin/varnishtest/tests/r01648.vtc
0 → 100644
View file @
dba9daad
varnishtest "#1648 - corrupt object in cache through IMS update"
# This server sends a broken response body
server s1 {
rxreq
txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Etag: \"foo\"" -hdr "Server: s1"
sema r1 sync 3
delay 1
chunked "abc"
} -start
# This server validates the streaming response from s1 as it hasn't failed yet
server s2 {
rxreq
expect req.http.If-None-Match == "\"foo\""
sema r1 sync 3
txresp -status 304 -nolen -hdr "Server: s2"
} -start
# This server sends the proper response body
server s3 {
rxreq
txresp -hdr "Server: s3" -body "abcdef"
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.client == "c1") {
set req.backend_hint = s1;
} else if (req.http.client == "c2") {
set req.backend_hint = s2;
} else if (req.http.client == "c3") {
set req.backend_hint = s3;
}
}
sub vcl_backend_response {
if (bereq.http.client == "c1") {
set beresp.ttl = 0.1s;
set beresp.grace = 0s;
set beresp.keep = 60s;
}
}
} -start
varnish v1 -cliok "param.set debug +syncvsl"
# This client gets a streaming failing result from s1
client c1 {
txreq -hdr "Client: c1"
rxresphdrs
expect resp.status == 200
expect resp.http.transfer-encoding == "chunked"
} -start
delay 1
# This client gets a streaming failing result from s1 through
# IMS update by s2
client c2 {
txreq -hdr "Client: c2"
sema r1 sync 3
rxresphdrs
expect resp.status == 200
expect resp.http.transfer-encoding == "chunked"
} -run
delay 1
# This client should get a fresh fetch from s3
client c3 {
txreq -hdr "Client: c3"
rxresp
expect resp.status == 200
expect resp.body == "abcdef"
} -run
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment