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
63ecfe6a
Commit
63ecfe6a
authored
Nov 14, 2018
by
Dag Haavi Finstad
Committed by
Dridi Boukelmoune
Feb 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error handling for STV_NewObject() in vrb_pull
Fixes: #2831
parent
c8faf7ec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
1 deletion
+65
-1
cache_req_body.c
bin/varnishd/cache/cache_req_body.c
+8
-1
r02831.vtc
bin/varnishtest/tests/r02831.vtc
+57
-0
No files found.
bin/varnishd/cache/cache_req_body.c
View file @
63ecfe6a
...
...
@@ -73,7 +73,14 @@ vrb_pull(struct req *req, ssize_t maxsize, objiterate_f *func, void *priv)
req
->
storage
=
NULL
;
XXXAN
(
STV_NewObject
(
req
->
wrk
,
req
->
body_oc
,
stv
,
8
));
if
(
STV_NewObject
(
req
->
wrk
,
req
->
body_oc
,
stv
,
8
)
==
0
)
{
req
->
req_body_status
=
REQ_BODY_FAIL
;
HSH_DerefBoc
(
req
->
wrk
,
req
->
body_oc
);
AZ
(
HSH_DerefObjCore
(
req
->
wrk
,
&
req
->
body_oc
,
0
));
(
void
)
VFP_Error
(
vfc
,
"Object allocation failed:"
" Ran out of space in %s"
,
stv
->
vclname
);
return
(
-
1
);
}
vfc
->
oc
=
req
->
body_oc
;
...
...
bin/varnishtest/tests/r02831.vtc
0 → 100644
View file @
63ecfe6a
varnishtest "#2831: Out of storage in cache_req_body"
server s1 {
rxreq
expect req.url == "/obj1"
txresp -bodylen 1048400
} -start
varnish v1 \
-arg "-p nuke_limit=0" \
-arg "-sTransient=default,1m" \
-syntax 4.0 \
-vcl+backend {
import std;
sub vcl_recv {
if (req.method == "POST") {
std.cache_req_body(1KB);
}
}
sub vcl_backend_response {
set beresp.do_stream = false;
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 "/obj1"
rxresp
expect resp.status == 200
} -run
delay .1
varnish v1 -expect SM?.Transient.g_bytes > 1048400
varnish v1 -expect SM?.Transient.g_space < 100
client c1 {
# No space for caching this req.body
txreq -req "POST" -body "foobar"
delay 1
} -run
varnish v1 -expect SMA.Transient.c_fail == 1
client c1 {
# Check that Varnish is still alive
txreq -url "/obj1"
rxresp
expect resp.status == 200
} -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