Skip to content

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

Merged
maxlambrecht merged 1 commit into
spiffe:mainfrom
maxlambrecht:fix/workloadapi-close-watch-lifecycle
Jul 23, 2026
Merged

fix(workloadapi): reject watches after client close#435
maxlambrecht merged 1 commit 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.*'

@maxlambrecht
maxlambrecht requested a review from rturner3 as a code owner May 9, 2026 20:34
@maxlambrecht
maxlambrecht force-pushed the fix/workloadapi-close-watch-lifecycle branch from a272b81 to aaf694b Compare July 18, 2026 20:37
Signed-off-by: Max Lambrecht <maxlambrecht@gmail.com>
@maxlambrecht
maxlambrecht force-pushed the fix/workloadapi-close-watch-lifecycle branch from ce32fb6 to d842f8e Compare July 23, 2026 15:32
@maxlambrecht
maxlambrecht merged commit e854771 into spiffe:main Jul 23, 2026
8 checks passed
@maxlambrecht
maxlambrecht deleted the fix/workloadapi-close-watch-lifecycle branch July 23, 2026 15:33
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.

2 participants