fix(workloadapi): reconnect watchers on stream EOF - #450
Open
maxlambrecht wants to merge 1 commit into
Open
Conversation
Treat normal stream EOF as reconnectable while the watcher is active, reset retry state only after a delivered update, and exit silently on explicit cancellation without calling on_error. Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
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.
What
Fix X.509 and JWT Workload API watcher lifecycle for normal stream EOF, explicit cancellation, and retry state.
While a watcher is active, a finite response stream ending normally reconnects per the retry policy instead of being treated as permanent success. Retry/backoff state resets only after a valid update is delivered. User cancellation exits promptly and silently (no
on_error, no reconnect). With retries disabled, stream end remains fail-closed viaon_error. Public stream method docs now describe this contract.Why
Watchers previously treated normal EOF as successful completion and could reset retry state just because an iterator ended. That stopped rotation updates after a stream close and could report errors (or reconnect) on explicit cancel. Sources and long-lived callers need fail-closed, cancel-safe, reconnect-on-EOF semantics for both X.509 and JWT streams.
How tested
pytest spiffe/tests/unit/workloadapi/test_workload_api_client_fetch_x509.py spiffe/tests/unit/workloadapi/test_workload_api_client_jwt.py(80 passed)