Skip to content

Commit 436961b

Browse files
committed
Fix too_many_pings during DPU SetPackage by coordinating keepalive settings
The DPU proxy client was sending keepalive pings every 10s, but the gRPC server uses the default EnforcementPolicy with MinTime=5m. During long-running SetPackage operations (sonic-installer can take minutes), this mismatch causes the server to terminate the connection with GOAWAY/ENHANCE_YOUR_CALM and debug data 'too_many_pings'. Fix: 1. Increase proxy client keepalive interval from 10s to 30s and timeout from 3s to 10s for better resilience during long operations. 2. Add explicit KeepaliveEnforcementPolicy to the gNMI server allowing pings as frequent as every 20s, with a safety margin above the client's 30s interval. Fixes: #619 Related: sonic-net/sonic-mgmt#23054 Signed-off-by: Dawei Huang <daweihuang@microsoft.com>
1 parent 3da860e commit 436961b

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

pkg/interceptors/dpuproxy/proxy.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,13 +177,18 @@ func (p *DPUProxy) getConnection(ctx context.Context, dpuIndex, ipAddress string
177177
target := fmt.Sprintf("%s:%s", ipAddress, port)
178178
glog.Infof("[DPUProxy] Trying to connect to DPU%s at %s (attempt %d/%d)", dpuIndex, target, i+1, len(portsToTry))
179179

180-
// Create connection with keepalive settings for long-lived connections
180+
// Create connection with keepalive settings for long-lived connections.
181+
// Use a conservative ping interval to avoid triggering the server's
182+
// default EnforcementPolicy (MinTime=5m). Operations like SetPackage
183+
// can block for minutes during image installation; aggressive pinging
184+
// causes the server to send GOAWAY with "too_many_pings".
185+
// See: https://github.com/sonic-net/sonic-gnmi/issues/619
181186
conn, err := grpc.NewClient(
182187
target,
183188
grpc.WithTransportCredentials(insecure.NewCredentials()),
184189
grpc.WithKeepaliveParams(keepalive.ClientParameters{
185-
Time: 10 * time.Second, // Send keepalive ping every 10s
186-
Timeout: 3 * time.Second, // Wait 3s for ping ack before considering connection dead
190+
Time: 30 * time.Second, // Send keepalive ping every 30s
191+
Timeout: 10 * time.Second, // Wait 10s for ping ack before considering connection dead
187192
PermitWithoutStream: true, // Send pings even when no active RPCs
188193
}),
189194
)

telemetry/telemetry.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,17 @@ func startGNMIServer(telemetryCfg *TelemetryConfig, cfg *gnmi.Config, serverCont
527527
MaxConnectionIdle: time.Duration(*telemetryCfg.IdleConnDuration) * time.Second, // duration in which idle connection will be closed, default is inf
528528
}
529529

530+
// Allow clients (e.g. DPU proxy) to send keepalive pings at a
531+
// reasonable rate. Without this the default MinTime is 5 minutes,
532+
// causing "too_many_pings" GOAWAY for clients that ping more
533+
// frequently during long-running operations like SetPackage.
534+
// See: https://github.com/sonic-net/sonic-gnmi/issues/619
535+
keep_alive_policy := keepalive.EnforcementPolicy{
536+
MinTime: 20 * time.Second, // Allow pings as frequent as every 20s
537+
PermitWithoutStream: true, // Allow pings when there are no active streams
538+
}
539+
commonOpts = append(commonOpts, grpc.KeepaliveEnforcementPolicy(keep_alive_policy))
540+
530541
tlsOpts = []grpc.ServerOption{grpc.Creds(credentials.NewTLS(tlsCfg))}
531542

532543
if *telemetryCfg.IdleConnDuration > 0 { // non inf case

0 commit comments

Comments
 (0)