Skip to content

test(server): fix flaky testSynchronousExecutorDoesNotLeakChainEntries - #1189

Merged
ehsavoie merged 1 commit into
a2aproject:mainfrom
ehsavoie:intermittent_failure
Sep 28, 2026
Merged

ehsavoie merged 1 commit into
a2aproject:mainfrom
ehsavoie:intermittent_failure

Conversation

@ehsavoie

Copy link
Copy Markdown
Collaborator

Two bugs caused intermittent failures:

  1. Latch count was taskCount (10) but each task generates TWO push notifications -> one for the Task event and one for the StatusUpdate event, both implementing StreamingEventKind -> so the latch could fire with 10 notifications still in flight. Fixed to taskCount * 2.

  2. TOCTOU race between the while-loop exit and assertEquals: with a synchronous executor, pushTask runs inside compute()'s lambda before the chain entry is stored, so the latch can reach 0 when count is transiently 0. The while exited on count==0 but assertEquals re-read count and could see 1 if the processor stored the entry in between. Fixed by switching to a do-while that always sleeps before the first check and asserts on the captured count, not a fresh read.

Two bugs caused intermittent failures:

1. Latch count was taskCount (10) but each task generates TWO push
   notifications -> one for the Task event and one for the StatusUpdate
   event, both implementing StreamingEventKind -> so the latch could fire
   with 10 notifications still in flight. Fixed to taskCount * 2.

2. TOCTOU race between the while-loop exit and assertEquals: with a
   synchronous executor, pushTask runs inside compute()'s lambda before
   the chain entry is stored, so the latch can reach 0 when count is
   transiently 0. The while exited on count==0 but assertEquals re-read
   count and could see 1 if the processor stored the entry in between.
   Fixed by switching to a do-while that always sleeps before the first
   check and asserts on the captured count, not a fresh read.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
@ehsavoie
ehsavoie merged commit ad9571c into a2aproject:main Sep 28, 2026
15 checks passed
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