Repository navigation
Conversation
The stream deadline (FLAGD_STREAM_DEADLINE_MS, 10 min by default) is an application-layer keepalive: a healthy stream reaching it is expected. It was nevertheless handled as a stream error, emitting STALE (and ERROR after the grace period) and waiting retryBackoffMaxMs before reconnecting, every 10 minutes on every instance. A DEADLINE_EXCEEDED on a stream that already delivered data is now handled like a completed stream: immediate reconnect, no error event. A stream reaching its deadline without delivering any data is still reported as an error. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Alexandre Chakroun <achakroun@macmail.fr>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
github-actions
Bot
requested review from
Kavindu-Dodan,
beeme1mr,
thisthat and
toddbaert
October 23, 2026 13:18
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR
Treats a
DEADLINE_EXCEEDEDon the in-process sync stream as a routine reconnect rather than a stream error, when the stream already delivered data.Why
streamDeadlineMs(FLAGD_STREAM_DEADLINE_MS, 10 min by default) is documented as an application-layer keepalive, so a healthy stream reaching it is expected. Today it goes through the error path inSyncStreamQueueSource.handleObserverError, which on every instance, every 10 minutes:ERROR→ the provider emitsPROVIDER_STALEand schedulesPROVIDER_ERRORafter the grace period;shouldThrottle→ waitsretryBackoffMaxMsbefore reconnecting, so the provider stays STALE without a stream for the full backoff;retryBackoffMaxMsexceeds the grace period, logsProvider did not reconnect successfully within Xsand emitsPROVIDER_ERRORfor what was a planned recycle.With this change, a deadline on a stream that received at least one payload is handled like
onCompleted(): immediate reconnect, no event. flagd re-sends the full flag state on reconnect, so nothing is missed.Keeping the liveness check
The deadline exists to detect hung streams, so a stream that reaches its deadline without ever delivering data is still reported as an error (with backoff), exactly as before. Both cases are covered by new tests.
Consistency across providers
The Python provider made the matching change in open-feature/python-sdk-contrib#405 ("log expected sync-stream recycles at debug, not warning"), based on the same reasoning: with a 10 min default deadline, many stream "errors" are expected, and only the
stale -> errortransition is a real error. This PR brings the Java provider's in-process mode in line, and also goes one step further by skipping the STALE event and the backoff.Related discussion: open-feature/flagd#1959. A server-side complement (closing streams with OK at the deadline, which fixes all providers and tracing) is proposed in open-feature/flagd#2098.
Scope / notes
SyncStreamQueueSource) only. The RPC resolver (RpcResolver.observeEventStream) deliberately treats even a gracefulonCompletedas an error (it clears the evaluation cache), so changing that is a separate discussion. Happy to follow up if maintainers want the two modes aligned.DEADLINE_EXCEEDEDlisted infatalStatusCodesstill shuts down as before.How to test
deadlineExceededAfterDataReconnectsWithoutErrorOrBackofffails without the fix.deadlineExceededWithoutDataEnqueuesErrorPayloadguards the liveness behavior.🤖 Generated with Claude Code