Repository navigation
Description
Requirements
Problem
The flag-sync service exposes a long-lived SyncFlags gRPC stream that in-process providers consume. To keep that stream healthy across idle periods, providers send gRPC keepalive pings.
The sync gRPC server is currently constructed with a bare grpc.NewServer(...) and no KeepaliveEnforcementPolicy, so grpc-go's default enforcement applies: MinTime: 5m and PermitWithoutStream: false. Any client that pings more frequently than every 5 minutes — or pings while it holds no active stream — accumulates ping strikes, and the server responds with GOAWAY ENHANCE_YOUR_CALM (too_many_pings), tearing down the sync stream and forcing a reconnect.
This is a server-side default mismatch, not a single-client bug. flagd's own sync stream is long-lived and idle-tolerant by design, yet the server inherits grpc-go's generic-RPC defaults that assume pings are rare. Provider SDKs across languages set their own keepalive cadences; the Go provider is the sharpest case (a hardcoded 30s ping with PermitWithoutStream: true and no override), producing a GOAWAY roughly every 60–90s, but any provider — current or future, in any language — whose keepalive interval is tighter than 5 minutes is exposed to the same teardown. There is no server-side setting to correct this today.
Why fix it on the server
Keepalive enforcement is the server's contract: the server is the authority on "how often is too often." Patching each language provider's client keepalive instead would mean coordinated changes across every provider repo (Go, Java/Kotlin, TypeScript, …), wouldn't help third-party or future clients, and would leave the server rejecting perfectly reasonable keepalives by default. One server-side change fixes every client, in every language, at the correct layer.
Proposal
Set a streaming-appropriate KeepaliveEnforcementPolicy on the flag-sync gRPC server, with sane defaults and CLI/env overrides:
--keep-alive-min-time(envFLAGD_KEEP_ALIVE_MIN_TIME, duration, default30s) — minimum interval the server permits between client keepalive pings.--keep-alive-permit-without-stream(envFLAGD_KEEP_ALIVE_PERMIT_WITHOUT_STREAM, bool, defaulttrue) — permit pings when the client has no active stream.
Defaults are strictly more permissive than grpc-go's silent 5-minute default, so no currently-working client regresses; clients that are currently GOAWAY'd stop being torn down. Operators who want a tighter or looser policy can tune it without a code change.
Estate-wide / operator tuning
Because the policy is exposed as flags/env vars, it is configurable wherever flagd runs — including operator-managed flagd (sidecar or standalone) via container env/args. A single setting on the flagd server tunes keepalive tolerance for every consumer connecting to it, across languages and providers, without editing any gRPC client in any workload. (A dedicated field in the OpenFeature Operator CRD is a natural follow-up but not required — env/args already flow through.)
Scope
flag-sync gRPC server only. flagd-proxy and the evaluation/metrics servers are out of scope.
Acceptance
- Enforcement policy configurable via the two flags/env vars above, with the stated defaults.
- Auto-generated CLI reference updated.
- Unit test for the config→policy mapping; a behavioural test that an aggressively-pinging client is no longer GOAWAY'd.
- ADR added under
docs/architecture-decisions/.
PR coming for review.
Activity
feat(sync): configurable gRPC keepalive enforcement on sync server (#…
fix(flagd-proxy): set gRPC keepalive enforcement policy on the sync s…
fix(flagd-proxy): set gRPC keepalive enforcement policy on the sync s…
fix(flagd-proxy): set gRPC keepalive enforcement policy on the sync s…
fix(flagd-proxy): set gRPC keepalive enforcement policy on the sync s…
feat: migrate to the connect based grpc setup (#2042)