Commit eccb5083 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune Committed by Simon Stridsberg

http2_send: Promote global BROKE_WINDOW to BANKRUPT

When a stream times out waiting for window credits, and all the other
streams are broke, declare the whole connection bankrupt.
parent 42a10e90
......@@ -1360,11 +1360,12 @@ static h2_error
h2_sweep(struct worker *wrk, struct h2_sess *h2)
{
struct h2_req *r2, *r22;
h2_error h2e = NULL, tmo;
h2_error h2e, tmo;
vtim_real now;
ASSERT_RXTHR(h2);
h2e = h2->error;
now = VTIM_real();
if (h2e == NULL && h2->open_streams == 0 &&
h2->sess->t_idle + cache_param->timeout_idle < now)
......
......@@ -285,6 +285,10 @@ h2_do_window(struct worker *wrk, struct h2_req *r2,
assert (w > 0);
}
if (r2->error == H2SE_BROKE_WINDOW &&
h2->open_streams <= h2->winup_streams)
h2->error = r2->error = H2CE_BANKRUPT;
assert(h2->winup_streams > 0);
h2->winup_streams--;
......
......@@ -6,7 +6,13 @@ server s1 {
} -start
varnish v1 -cliok "param.set feature +http2"
varnish v1 -vcl+backend "" -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.url ~ "synth") {
return (synth(200));
}
}
} -start
# coverage for send_timeout with c1
......@@ -66,6 +72,10 @@ client c2 {
} -run
stream 1 {
txreq -nostrend -url "/synth"
} -run
stream 3 {
txreq
rxhdrs
rxdata
......@@ -75,6 +85,9 @@ client c2 {
expect rst.err == CANCEL
} -run
stream 1 {
txdata
} -run
} -run
logexpect l2 -wait
......@@ -100,6 +113,10 @@ client c3 {
} -run
stream 1 {
txreq -nostrend -url "/synth"
} -run
stream 3 {
txreq
rxhdrs
rxdata
......@@ -110,6 +127,9 @@ client c3 {
expect rst.err == CANCEL
} -run
stream 1 {
txdata
} -run
} -start
barrier b3 sync
......
......@@ -171,6 +171,14 @@ H2_ERROR(
/* reason */ SC_NULL,
/* descr */ "http/2 stream out of window credits"
)
H2_ERROR(
/* name */ BANKRUPT,
/* val */ 11, /* ENHANCE_YOUR_CALM */
/* types */ 1,
/* reason */ SC_BANKRUPT,
/* descr */ "http/2 bankrupt connection"
)
# undef H2_CUSTOM_ERRORS
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment