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: ef74c9577a
GitHub-Pull-Request: golang/net#229
Reviewed-on: https://go-review.googlesource.com/c/net/+/635555
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
Hubert Grochowski
2025-01-08 14:39:34 +00:00
committed by Gopher Robot
parent 55989e24b9
commit 09731f9bf9

View File

@@ -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
}