Skip to content

fix(workloadapi): reject watches after client close#435

Open
maxlambrecht wants to merge 2 commits into
spiffe:mainfrom
maxlambrecht:fix/workloadapi-close-watch-lifecycle
Open

fix(workloadapi): reject watches after client close#435
maxlambrecht wants to merge 2 commits into
spiffe:mainfrom
maxlambrecht:fix/workloadapi-close-watch-lifecycle

Conversation

@maxlambrecht
Copy link
Copy Markdown
Member

What

  • Reject watchX509Context, watchX509Bundles, and watchJwtBundles calls after DefaultWorkloadApiClient.close().
  • Snapshot and clear registered cancellable contexts while synchronized on the context list before closing them.
  • Add focused tests for watch-after-close behavior and synchronized shutdown snapshotting.

Why

The client previously allowed new watch registrations after shutdown and iterated a synchronized list without holding the list monitor during close. This could leave lifecycle behavior inconsistent and make shutdown iteration unsafe.

How tested

  • ./gradlew :java-spiffe-core:test --tests 'io.spiffe.workloadapi.*'

Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
@maxlambrecht maxlambrecht requested a review from rturner3 as a code owner May 9, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant