Repository navigation
fix(server): deliver awaited final events to gracefully closed child queues - #1227
jeroenbellen wants to merge 2 commits into
Conversation
…queues A blocking message/send closes the caller's child queue as soon as the agent returns, while the final event can still be in the MainEventBus. Since dabca6c, distributeToChildren skipped every closed child, so the final event was lost and the EventConsumer waited out its 3-second grace period for it. Deliver to a closed child that is still awaiting a final event; a gracefully closed child still drains its queue. Fixes a2aproject#1226
44136ed to
58620e4
Compare
There was a problem hiding this comment.
Update the comment as this was the flawed assumption the bug was predicated on. The fix in the very next line disproves it.
There was a problem hiding this comment.
Updated in f715ea0: the comment no longer states the old assumption, and it explains why a child closed while awaiting a final event must still receive it.
There was a problem hiding this comment.
The assertTrue — on a background thread — could throw AssertionError if the latch timed out, and that error would be swallowed by the event bus processor rather than failing the test. The latch result should be captured in AtomicBoolean and asserted on the main thread.
There was a problem hiding this comment.
Done in f715ea0: the callback stores the latch result in an AtomicBoolean, and the test asserts it on the main thread.
…t on the main thread

Description
Regression from dabca6c (1.4.0.Final). A blocking message/send closes the caller's child queue (step 2
in DefaultRequestHandler) as soon as the agent returns. If the final event is still in the MainEventBus
at that moment, distributeToChildren skipped the closed child, and the EventConsumer waited out its
3-second grace period for the final event it had been told to expect. See #1226 for the full sequence.
This delivers the event to a closed child that is still awaiting a final event. The new test in
DefaultRequestHandlerTest holds the event in the bus until the queue is closed; it fails without the
change and passes with it. All server-common tests pass.
Fixes #1226