From 2567be8040f085b9e01fbda32cc591c3409b79a4 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 22 Dec 2025 18:25:21 -0800 Subject: [PATCH] refactor: remove unused gRPC connection age parameters (#7852) The GrpcMaxConnectionAge and GrpcMaxConnectionAgeGrace constants have a troubled history - they were removed in 2022 due to gRPC issues, reverted later, and recently re-added. However, they are not essential to the core worker reconnection fix which was solved through proper goroutine ordering. The Docker Swarm DNS handling mentioned in the comments is not critical, and these parameters have caused problems in the past. Removing them simplifies the configuration without losing functionality. --- weed/pb/grpc_client_server.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go index ebd2220df..4a869bb95 100644 --- a/weed/pb/grpc_client_server.go +++ b/weed/pb/grpc_client_server.go @@ -35,11 +35,6 @@ const ( // gRPC keepalive settings - must be consistent between client and server GrpcKeepAliveTime = 60 * time.Second // ping interval when no activity GrpcKeepAliveTimeout = 20 * time.Second // ping timeout - - // Connection recycling for Docker Swarm environments - // Forces connections to be recycled periodically to handle DNS changes - GrpcMaxConnectionAge = 5 * time.Minute // max time a connection may exist - GrpcMaxConnectionAgeGrace = 30 * time.Second // grace period for RPCs to complete ) var ( @@ -63,10 +58,8 @@ func NewGrpcServer(opts ...grpc.ServerOption) *grpc.Server { var options []grpc.ServerOption options = append(options, grpc.KeepaliveParams(keepalive.ServerParameters{ - Time: GrpcKeepAliveTime, // server pings client if no activity for this long - Timeout: GrpcKeepAliveTimeout, // ping timeout - MaxConnectionAge: GrpcMaxConnectionAge, // max connection age for Docker Swarm DNS refresh - MaxConnectionAgeGrace: GrpcMaxConnectionAgeGrace, // grace period for in-flight RPCs + Time: GrpcKeepAliveTime, // server pings client if no activity for this long + Timeout: GrpcKeepAliveTimeout, // ping timeout }), grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{ MinTime: GrpcKeepAliveTime, // min time a client should wait before sending a ping