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
8633ce15
Commit
8633ce15
authored
Oct 02, 2017
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix an off-by-one in the max_restarts check
max_restarts is the number of allowed restarts Related to #2405
parent
a51affc8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
7 deletions
+13
-7
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+1
-1
b00019.vtc
bin/varnishtest/tests/b00019.vtc
+8
-6
changes.rst
doc/changes.rst
+4
-0
No files found.
bin/varnishd/cache/cache_req_fsm.c
View file @
8633ce15
...
@@ -727,7 +727,7 @@ cnt_restart(struct worker *wrk, struct req *req)
...
@@ -727,7 +727,7 @@ cnt_restart(struct worker *wrk, struct req *req)
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
req
->
director_hint
=
NULL
;
req
->
director_hint
=
NULL
;
if
(
++
req
->
restarts
>
=
cache_param
->
max_restarts
)
{
if
(
++
req
->
restarts
>
cache_param
->
max_restarts
)
{
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"Too many restarts"
);
VSLb
(
req
->
vsl
,
SLT_VCL_Error
,
"Too many restarts"
);
req
->
err_code
=
503
;
req
->
err_code
=
503
;
req
->
req_step
=
R_STP_SYNTH
;
req
->
req_step
=
R_STP_SYNTH
;
...
...
bin/varnishtest/tests/b00019.vtc
View file @
8633ce15
...
@@ -26,15 +26,17 @@ varnish v1 -vcl+backend {
...
@@ -26,15 +26,17 @@ varnish v1 -vcl+backend {
}
}
sub vcl_synth {
sub vcl_synth {
if (req.restarts == 2) {
# when we end up here, we have _exceeded_ the number
# allowed restarts
if (req.restarts == 3) {
set resp.status = 200;
set resp.status = 200;
set resp.reason = "restart=
2
";
set resp.reason = "restart=
3
";
} elsif (req.restarts >
2
) {
} elsif (req.restarts >
3
) {
set resp.status = 501;
set resp.status = 501;
set resp.reason = "restart>
2
";
set resp.reason = "restart>
3
";
} elsif (req.restarts <
2
) {
} elsif (req.restarts <
3
) {
set resp.status = 500;
set resp.status = 500;
set resp.reason = "restart<
2
";
set resp.reason = "restart<
3
";
}
}
}
}
} -start
} -start
...
...
doc/changes.rst
View file @
8633ce15
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
Varnish Cache Trunk (ongoing)
Varnish Cache Trunk (ongoing)
=============================
=============================
* Fixed implementation of the ``max_restarts`` limit: It used to be one
less than the number of allowed restarts, it now is the number of
``return(restart)``s per request.
================================
================================
Varnish Cache 5.2.0 (2017-09-15)
Varnish Cache 5.2.0 (2017-09-15)
================================
================================
...
...
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