Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit 9d62040

Browse files
committed
Introduce RAPID_RESET as a sess_close reason
1 parent a517cc8 commit 9d62040

5 files changed

Lines changed: 24 additions & 1 deletion

File tree

bin/varnishd/http2/cache_http2_proto.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "vtcp.h"
4747
#include "vtim.h"
4848

49+
#define H2_CUSTOM_ERRORS
4950
#define H2EC1(U,v,r,d) const struct h2_error_s H2CE_##U[1] = {{#U,d,v,0,1,r}};
5051
#define H2EC2(U,v,r,d) const struct h2_error_s H2SE_##U[1] = {{#U,d,v,1,0,r}};
5152
#define H2EC3(U,v,r,d) H2EC1(U,v,r,d) H2EC2(U,v,r,d)
@@ -351,7 +352,7 @@ h2_rx_rst_stream(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
351352
Lck_Lock(&h2->sess->mtx);
352353
VSLb(h2->vsl, SLT_Error, "H2: Hit RST limit. Closing session.");
353354
Lck_Unlock(&h2->sess->mtx);
354-
return (H2CE_ENHANCE_YOUR_CALM);
355+
return (H2CE_RAPID_RESET);
355356
}
356357
h2->rst_budget -= 1.0;
357358

bin/varnishtest/tests/r03996.vtc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ client c1 {
3737
stream 0 -wait
3838
} -run
3939

40+
varnish v1 -expect sc_rapid_reset == 1

include/tbl/h2_error.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,17 @@ H2_ERROR(
147147
/* descr */ "Use HTTP/1.1 for the request"
148148
)
149149

150+
#ifdef H2_CUSTOM_ERRORS
151+
H2_ERROR(
152+
/* name */ RAPID_RESET,
153+
/* val */ 11, /* ENHANCE_YOUR_CALM */
154+
/* types */ 1,
155+
/* reason */ SC_RAPID_RESET,
156+
/* descr */ "http/2 rapid reset detected"
157+
)
158+
159+
# undef H2_CUSTOM_ERRORS
160+
#endif
161+
150162
#undef H2_ERROR
151163
/*lint -restore */

include/tbl/sess_close.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ SESS_CLOSE(PIPE_OVERFLOW, pipe_overflow,1, "Session pipe overflow")
5050
SESS_CLOSE(RANGE_SHORT, range_short, 1, "Insufficient data for range")
5151
SESS_CLOSE(REQ_HTTP20, req_http20, 1, "HTTP2 not accepted")
5252
SESS_CLOSE(VCL_FAILURE, vcl_failure, 1, "VCL failure")
53+
SESS_CLOSE(RAPID_RESET, rapid_reset, 1, "HTTP2 rapid reset")
5354
#undef SESS_CLOSE
5455

5556
/*lint -restore */

lib/libvsc/VSC_main.vsc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,14 @@
634634

635635
Number of session closes with Error VCL_FAILURE (VCL failure)
636636

637+
.. varnish_vsc:: sc_rapid_reset
638+
:level: diag
639+
:oneliner: Session Err RAPID_RESET
640+
641+
Number of times we failed an http/2 session because it hit its
642+
configured limits for the number of permitted rapid stream
643+
resets.
644+
637645
.. varnish_vsc:: client_resp_500
638646
:level: diag
639647
:group: wrk

0 commit comments

Comments
 (0)