acoustic-carpenter-78188
05/29/2026, 7:24 PM*grpc.ClientConn per endpoint for the process lifetime, so when the gateway closes the connection the cached client only discovers it on the next RPC, which then fails with:
rpc error: code = Unavailable desc = connection error: desc =
"error reading server preface: ... use of closed network connection"
surfacing to users as failed to create task from connector .... Today the client sets no keepalive and no retry policy (unless a deployment happens to specify DefaultServiceConfig), so a single reaped connection fails the in-flight task RPC.
What changes were proposed in this pull request?
In `flyteplugins/go/tasks/plugins/webapi/connector`:
1. Keepalive (primary fix). getGrpcConnection now always sets keepalive.ClientParameters{Time: 30s, Timeout: 10s, PermitWithoutStream: true} so long-lived connector connections are not reaped while idle and a half-dead connection is detected proactively instead of on the next RPC.
2. Default service config with retry. Introduced a package-level defaultGRPCServiceConfig (round-robin LB + retryPolicy retrying only UNAVAILABLE, with exponential backoff, plus retryThrottling to avoid hammering a connector that is genuinely down). getGrpcConnection falls back to it when a Deployment does not set its own DefaultServiceConfig, so every deployment (DefaultConnector, connectors, connectorApps) gets LB + retry uniformly without per-deployment config. Per-deployment DefaultServiceConfig still overrides.
UNAVAILABLE is the only retried code: the "server preface" failure means the request was never delivered, so retrying is safe; the connector's async create/get/delete are keyed by task-execution-id so retries are idempotent.
How was this patch tested?
Unit tests added/updated in the same package (go test ./go/tasks/plugins/webapi/connector/... passes, go vet and gofmt clean):
• TestDefaultGRPCServiceConfig — asserts the default config is valid JSON (grpc silently ignores malformed configs), uses round_robin, targets flyteidl2.connector.AsyncConnectorService, retries only UNAVAILABLE, and includes retryThrottling.
• TestGetGrpcConnection — verifies the empty→fallback path and that a deployment-specific DefaultServiceConfig still takes precedence.
• Updated TestDefaultAgentConfig for the new empty default.
Labels
• fixed
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
flyteorg/flyte