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
64c0e1ae
Commit
64c0e1ae
authored
Jun 27, 2019
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that we always log h2 idle_send_timeout
parent
bb8e3ec7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
6 deletions
+63
-6
cache_http2_proto.c
bin/varnishd/http2/cache_http2_proto.c
+8
-2
cache_http2_send.c
bin/varnishd/http2/cache_http2_send.c
+12
-4
t02016.vtc
bin/varnishtest/tests/t02016.vtc
+43
-0
No files found.
bin/varnishd/http2/cache_http2_proto.c
View file @
64c0e1ae
...
...
@@ -975,11 +975,17 @@ h2_stream_tmo(struct h2_sess *h2, const struct h2_req *r2, vtim_real now)
CHECK_OBJ_NOTNULL
(
r2
,
H2_REQ_MAGIC
);
Lck_AssertHeld
(
&
h2
->
sess
->
mtx
);
/* NB: when now is NAN, it means that idle_send_timeout was hit
* on a lock condwait operation.
*/
if
(
isnan
(
now
))
AN
(
r2
->
t_winupd
);
if
(
r2
->
t_winupd
==
0
&&
r2
->
t_send
==
0
)
return
(
0
);
if
(
r2
->
t_winupd
!=
0
&&
now
-
r2
->
t_winupd
>
cache_param
->
idle_send_timeout
)
{
if
(
isnan
(
now
)
||
(
r2
->
t_winupd
!=
0
&&
now
-
r2
->
t_winupd
>
cache_param
->
idle_send_timeout
)
)
{
VSLb
(
h2
->
vsl
,
SLT_Debug
,
"H2: stream %u: Hit idle_send_timeout waiting for"
" WINDOW_UPDATE"
,
r2
->
stream
);
...
...
bin/varnishd/http2/cache_http2_send.c
View file @
64c0e1ae
...
...
@@ -58,21 +58,29 @@ h2_cond_wait(pthread_cond_t *cond, struct h2_sess *h2, struct h2_req *r2)
when
=
now
+
cache_param
->
idle_send_timeout
;
r
=
Lck_CondWait
(
cond
,
&
h2
->
sess
->
mtx
,
when
);
assert
(
r
==
0
||
r
==
ETIMEDOUT
);
now
=
VTIM_real
();
/* NB: when we grab idle_send_timeout before acquiring the session
* lock we may time out, but once we wake up both send_timeout and
* idle_send_timeout may have changed meanwhile. For this reason
* h2_stream_tmo() may not log what timed out and we need to check
* both conditions to decide whether we cancel the stream or not.
* h2_stream_tmo() may not log what timed out and we need to call
* again with a magic NAN "now" that indicates to h2_stream_tmo()
* that the stream reached the idle_send_timeout via the lock and
* force it to log it.
*/
if
(
h2_stream_tmo
(
h2
,
r2
,
now
)
||
r
==
ETIMEDOUT
)
{
if
(
h2_stream_tmo
(
h2
,
r2
,
now
))
r
=
ETIMEDOUT
;
else
if
(
r
==
ETIMEDOUT
)
AN
(
h2_stream_tmo
(
h2
,
r2
,
NAN
));
if
(
r
==
ETIMEDOUT
)
{
if
(
r2
->
error
==
NULL
)
r2
->
error
=
H2SE_CANCEL
;
return
(
-
1
);
}
AZ
(
r
);
return
(
0
);
}
...
...
bin/varnishtest/tests/t02016.vtc
View file @
64c0e1ae
...
...
@@ -8,6 +8,8 @@ server s1 {
varnish v1 -cliok "param.set feature +http2"
varnish v1 -vcl+backend "" -start
# coverage for send_timeout with c1
varnish v1 -cliok "param.set send_timeout 1"
logexpect l1 -v v1 {
...
...
@@ -42,6 +44,8 @@ client c1 {
logexpect l1 -wait
# coverage for idle_send_timeout with c2
varnish v1 -cliok "param.set idle_send_timeout 1"
varnish v1 -cliok "param.reset send_timeout"
...
...
@@ -74,3 +78,42 @@ client c2 {
} -run
logexpect l2 -wait
# coverage for idle_send_timeout change with c3
barrier b3 cond 2
logexpect l3 -v v1 {
expect * * Debug "Hit idle_send_timeout"
} -start
client c3 {
txpri
stream 0 {
rxsettings
expect settings.ack == false
txsettings -ack
txsettings -winsize 1000
rxsettings
expect settings.ack == true
} -run
stream 1 {
txreq
rxhdrs
rxdata
# keep the stream idle for 2 seconds
barrier b3 sync
delay 2
rxrst
expect rst.err == CANCEL
} -run
} -start
barrier b3 sync
varnish v1 -cliok "param.reset idle_send_timeout"
client c3 -wait
logexpect l3 -wait
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