forked from haproxy/haproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MINOR: connection: add sample fetches to report per-connection glitches
Now with fc_glitches and bc_glitches we can retrieve the number of detected glitches on a front or back connection. On the backend it can indicate a bug in a server that may induce frequent reconnections hence CPU usage in TLS reconnections, and on the frontend it may indicate an abusive client that may be trying to attack the stack or to fingerprint it. Small non-zero values are definitely expected and can be caused by network glitches for example, as well as rare bugs in the other component (or maybe even in haproxy). These should never be considered as alarming as long as they remain low (i.e. much less than one per request). A reg-test is provided.
- Loading branch information
Showing
3 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# This test verifies that H2 anomalies counted as glitches are properly detected | ||
# and fetched. | ||
|
||
varnishtest "h2 glitches" | ||
feature ignore_unknown_macro | ||
|
||
# haproxy frontend | ||
haproxy hap -conf { | ||
defaults | ||
mode http | ||
|
||
listen fe1 | ||
bind "fd@${fe1}" proto h2 | ||
http-request return status 200 hdr x-glitches %[fc_glitches] | ||
} -start | ||
|
||
# valid request: no glitch | ||
client c1 -connect ${hap_fe1_sock} { | ||
txpri | ||
stream 0 { | ||
txsettings | ||
rxsettings | ||
txsettings -ack | ||
rxsettings | ||
expect settings.ack == true | ||
} -run | ||
|
||
stream 1 { | ||
txreq \ | ||
-method "GET" \ | ||
-scheme "http" \ | ||
-url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.x-glitches == 0 | ||
} -run | ||
|
||
stream 3 { | ||
txreq \ | ||
-method "GET" \ | ||
-scheme "http" \ | ||
-url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.x-glitches == 0 | ||
} -run | ||
} -run | ||
|
||
# invalid path: => req decoding error => glitch++ | ||
client c2-path -connect ${hap_fe1_sock} { | ||
txpri | ||
stream 0 { | ||
txsettings | ||
rxsettings | ||
txsettings -ack | ||
rxsettings | ||
expect settings.ack == true | ||
} -run | ||
|
||
stream 1 { | ||
txreq \ | ||
-method "GET" \ | ||
-scheme "http" \ | ||
-url "hello-world" | ||
rxrst | ||
} -run | ||
|
||
stream 3 { | ||
txreq \ | ||
-method "GET" \ | ||
-scheme "http" \ | ||
-url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.x-glitches == 1 | ||
} -run | ||
} -run | ||
|
||
# invalid scheme: blocked at HTX layer, not counted | ||
client c3-scheme -connect ${hap_fe1_sock} { | ||
txpri | ||
stream 0 { | ||
txsettings | ||
rxsettings | ||
txsettings -ack | ||
rxsettings | ||
expect settings.ack == true | ||
} -run | ||
|
||
stream 1 { | ||
txreq \ | ||
-method "GET" \ | ||
-scheme "http://localhost/?" \ | ||
-url "/" | ||
rxresp | ||
expect resp.status == 400 | ||
} -run | ||
|
||
stream 3 { | ||
txreq \ | ||
-method "GET" \ | ||
-scheme "http" \ | ||
-url "/" | ||
rxresp | ||
expect resp.status == 200 | ||
expect resp.http.x-glitches == 0 | ||
} -run | ||
} -run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters