From 09731f9bf919b00b344c763894cd1920b3d96d90 Mon Sep 17 00:00:00 2001 From: Hubert Grochowski Date: Wed, 8 Jan 2025 14:39:34 +0000 Subject: [PATCH] http2: improve handling of lost PING in Server This addresses inconsistencies in handling lost PINGs between Server and Transport by: 1. Always logging a message for lost PINGs, regardless of verbose mode. 2. Invoking CountError with the conn_close_lost_ping error key. Fixes golang/go#69963 Change-Id: I58fee489f7896dbb80ccc50265452cd953f7ca6b GitHub-Last-Rev: ef74c9577a4005018c2303810947d2da4f5b4ca6 GitHub-Pull-Request: golang/net#229 Reviewed-on: https://go-review.googlesource.com/c/net/+/635555 Auto-Submit: Sean Liao LUCI-TryBot-Result: Go LUCI Reviewed-by: Sean Liao Reviewed-by: Damien Neil Reviewed-by: David Chase --- http2/server.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/http2/server.go b/http2/server.go index b640deb0..51fca38f 100644 --- a/http2/server.go +++ b/http2/server.go @@ -1068,7 +1068,10 @@ func (sc *serverConn) serve(conf http2Config) { func (sc *serverConn) handlePingTimer(lastFrameReadTime time.Time) { if sc.pingSent { - sc.vlogf("timeout waiting for PING response") + sc.logf("timeout waiting for PING response") + if f := sc.countErrorFunc; f != nil { + f("conn_close_lost_ping") + } sc.conn.Close() return }