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
ce562c0a
Commit
ce562c0a
authored
Mar 06, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a vtc to tell us where our default stacksize is too tight
Ref #2817
parent
11a2c94a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
0 deletions
+145
-0
r02817.vtc
bin/varnishtest/tests/r02817.vtc
+117
-0
vmod.vcc
lib/libvmod_debug/vmod.vcc
+9
-0
vmod_debug.c
lib/libvmod_debug/vmod_debug.c
+19
-0
No files found.
bin/varnishtest/tests/r02817.vtc
0 → 100644
View file @
ce562c0a
varnishtest "canary to tell us if our default stacksize is too tight"
server s1 {
rxreq
expect req.http.esi0 == "foo"
txresp -gzipbody {
<html>
Before include
<esi:include
src=
"/a"
sr=
"foo"
/>
After include
</html>
}
rxreq
expect req.url == "/a1"
expect req.http.esi0 != "foo"
txresp -gzipbody {
<html>
Before include
<esi:include
src=
"/b"
sr=
"foo"
/>
After include
</html>
}
rxreq
expect req.url == "/b2"
expect req.http.esi0 != "foo"
txresp -gzipbody {
<html>
Before include
<esi:include
src=
"/c"
sr=
"foo"
/>
After include
</html>
}
rxreq
expect req.url == "/c3"
expect req.http.esi0 != "foo"
txresp -gzipbody {
<html>
Before include
<esi:include
src=
"/d"
sr=
"foo"
/>
After include
</html>
}
rxreq
expect req.url == "/d4"
expect req.http.esi0 != "foo"
txresp -gzipbody {
<html>
Before include
<esi:include
src=
"/e"
sr=
"foo"
/>
After include
</html>
}
rxreq
expect req.url == "/e5"
expect req.http.esi0 != "foo"
txresp -gzipbody {
<html>
LAST
</html>
}
} -start
varnish v1 -vcl+backend {
import std;
import debug;
sub recv0 { call recv1; std.log("STK recv0 " + debug.stk()); }
sub recv1 { call recv2; std.log("STK recv1 " + debug.stk()); }
sub recv2 { call recv3; std.log("STK recv2 " + debug.stk()); }
sub recv3 { call recv4; std.log("STK recv3 " + debug.stk()); }
sub recv4 { call recv5; std.log("STK recv4 " + debug.stk()); }
sub recv5 { call recv6; std.log("STK recv5 " + debug.stk()); }
sub recv6 { call recv7; std.log("STK recv6 " + debug.stk()); }
sub recv7 { call recv8; std.log("STK recv7 " + debug.stk()); }
sub recv8 { call recv9; std.log("STK recv8 " + debug.stk()); }
sub recv9 {
std.log("STK recv9 " + debug.stk());
set req.http.regex = regsub(req.url, "(.*)", "\1\1\1\1\1\1\1\1");
set req.http.regex = regsub(req.http.regex, "(.*)",
"\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1\1");
# hey geoff, this is deliberate
set req.http.regex = regsub(req.http.regex,
"(.*)(.{5})(.{6})(.{7})(.{8})", "/\5\4\3\2\1");
std.log("REGEX recv9 " + req.http.regex);
}
sub vcl_recv {
if (req.esi_level > 0) {
set req.url = req.url + req.esi_level;
} else {
set req.http.esi0 = "foo";
}
std.log("STK recv " + debug.stk());
call recv0;
}
sub vcl_backend_response {
set beresp.do_esi = true;
}
sub vcl_deliver {
std.log("STK deliver " + debug.stk());
}
} -start
client c1 {
txreq -hdr "Host: foo"
rxresp
expect resp.status == 200
}
client c1 -run
varnish v1 -expect esi_errors == 0
lib/libvmod_debug/vmod.vcc
View file @
ce562c0a
...
...
@@ -234,3 +234,12 @@ $Function STRANDS return_strands(STRANDS strand)
$Function VOID catflap(ENUM {miss, first, last} type)
Test the HSH_Lookup catflap
$Function BYTES stk()
Return an approximation of the amount of stack used.
This function is by no means guaranteed to work cross platform and
should now only be used for diagnostic purposes.
0B is returned if no sensible value can be determined.
lib/libvmod_debug/vmod_debug.c
View file @
ce562c0a
...
...
@@ -699,3 +699,22 @@ xyzzy_catflap(VRT_CTX, VCL_ENUM type)
WRONG
(
"Wrong VENUM"
);
}
}
VCL_BYTES
xyzzy_stk
(
VRT_CTX
)
{
const
VCL_BYTES
max
=
100
*
1024
*
1024
;
const
char
*
a
,
*
b
;
VCL_BYTES
r
;
a
=
TRUST_ME
(
&
b
);
b
=
TRUST_ME
(
ctx
->
req
->
wrk
);
b
+=
sizeof
(
*
ctx
->
req
->
wrk
);
if
(
b
>
a
&&
(
r
=
b
-
a
)
<
max
)
return
(
r
);
if
(
a
>
b
&&
(
r
=
a
-
b
)
<
max
)
return
(
r
);
return
(
0
);
}
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