From 4ca482946b689fb946147dd395ca201a3057ad19 Mon Sep 17 00:00:00 2001 From: Leif Hedstrom Date: Tue, 17 Mar 2020 11:38:35 -0600 Subject: [PATCH] Don't be overly aggressive on stream failures and closing --- proxy/http2/Http2ClientSession.cc | 4 ++-- proxy/http2/Http2ConnectionState.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/proxy/http2/Http2ClientSession.cc b/proxy/http2/Http2ClientSession.cc index ceb06d276db..da7d691d1ac 100644 --- a/proxy/http2/Http2ClientSession.cc +++ b/proxy/http2/Http2ClientSession.cc @@ -610,8 +610,8 @@ Http2ClientSession::state_process_frame_read(int event, VIO *vio, bool inside_fr ip_port_text_buffer ipb; const char *client_ip = ats_ip_ntop(get_client_addr(), ipb, sizeof(ipb)); Warning("HTTP/2 session error client_ip=%s session_id=%" PRId64 - " closing a connection, because its stream error rate (%f) is too high", - client_ip, connection_id(), this->connection_state.get_stream_error_rate()); + " closing a connection, because its stream error rate (%f) exceeded the threshold (%f)", + client_ip, connection_id(), this->connection_state.get_stream_error_rate(), Http2::stream_error_rate_threshold); err = Http2ErrorCode::HTTP2_ERROR_ENHANCE_YOUR_CALM; } diff --git a/proxy/http2/Http2ConnectionState.h b/proxy/http2/Http2ConnectionState.h index 7c81710e2af..6ba4ffea022 100644 --- a/proxy/http2/Http2ConnectionState.h +++ b/proxy/http2/Http2ConnectionState.h @@ -250,7 +250,8 @@ class Http2ConnectionState : public Continuation get_stream_error_rate() const { int total = get_stream_requests(); - if (total > 0) { + + if (total >= (1 / Http2::stream_error_rate_threshold)) { return (double)stream_error_count / (double)total; } else { return 0;