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
fe85c10c
Commit
fe85c10c
authored
Jan 17, 2014
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle the case where too many retries are attempted, by returning
a 503 reply. Fixes #1401
parent
4b573e1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
2 deletions
+67
-2
cache_fetch.c
bin/varnishd/cache/cache_fetch.c
+6
-2
r01401.vtc
bin/varnishtest/tests/r01401.vtc
+61
-0
No files found.
bin/varnishd/cache/cache_fetch.c
View file @
fe85c10c
...
@@ -244,6 +244,8 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
...
@@ -244,6 +244,8 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
VCL_backend_response_method
(
bo
->
vcl
,
wrk
,
NULL
,
bo
,
bo
->
beresp
->
ws
);
VCL_backend_response_method
(
bo
->
vcl
,
wrk
,
NULL
,
bo
,
bo
->
beresp
->
ws
);
if
(
wrk
->
handling
==
VCL_RET_RETRY
)
{
if
(
wrk
->
handling
==
VCL_RET_RETRY
)
{
if
(
bo
->
vbc
)
VDI_CloseFd
(
&
bo
->
vbc
);
bo
->
retries
++
;
bo
->
retries
++
;
if
(
bo
->
retries
<=
cache_param
->
max_retries
)
{
if
(
bo
->
retries
<=
cache_param
->
max_retries
)
{
// XXX: BereqEnd + BereqAcct ?
// XXX: BereqEnd + BereqAcct ?
...
@@ -254,10 +256,12 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
...
@@ -254,10 +256,12 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
owid
=
bo
->
vsl
->
wid
&
VSL_IDENTMASK
;
owid
=
bo
->
vsl
->
wid
&
VSL_IDENTMASK
;
bo
->
vsl
->
wid
=
wid
|
VSL_BACKENDMARKER
;
bo
->
vsl
->
wid
=
wid
|
VSL_BACKENDMARKER
;
VSLb
(
bo
->
vsl
,
SLT_Begin
,
"bereq %u retry"
,
owid
);
VSLb
(
bo
->
vsl
,
SLT_Begin
,
"bereq %u retry"
,
owid
);
VDI_CloseFd
(
&
bo
->
vbc
);
return
(
F_STP_STARTFETCH
);
return
(
F_STP_STARTFETCH
);
}
}
INCOMPL
();
VSLb
(
bo
->
vsl
,
SLT_VCL_Error
,
"Too many retries, delivering 503"
);
make_it_503
(
bo
);
wrk
->
handling
=
VCL_RET_DELIVER
;
}
}
assert
(
bo
->
state
==
BOS_REQ_DONE
);
assert
(
bo
->
state
==
BOS_REQ_DONE
);
...
...
bin/varnishtest/tests/r01401.vtc
0 → 100644
View file @
fe85c10c
varnishtest "too many retries"
server s1 {
rxreq
expect req.url == /1
txresp -hdr "foo: bar" -bodylen 5
accept
rxreq
expect req.url == /1
txresp -hdr "foo: foof" -hdr "Connection: close" -bodylen 7
accept
rxreq
expect req.url == /2
txresp -hdr "foo: bar" -bodylen 10
accept
rxreq
expect req.url == /2
txresp -hdr "foo: bar" -bodylen 11
accept
rxreq
expect req.url == /2
txresp -hdr "foo: bar" -bodylen 12
accept
rxreq
expect req.url == /2
txresp -hdr "foo: bar" -bodylen 13
accept
rxreq
expect req.url == /2
txresp -hdr "foo: bar" -bodylen 4
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
if (beresp.http.foo == "bar") {
return (retry);
}
}
} -start
client c1 {
txreq -url /1
rxresp
expect resp.http.foo == foof
expect resp.bodylen == 7
} -run
delay .1
client c1 {
txreq -url /2
rxresp
expect resp.status == 503
} -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