fix: Eliminate intermittent failure in testQueueClosedEventTerminates…#631
fix: Eliminate intermittent failure in testQueueClosedEventTerminates…#631kabir merged 1 commit intoa2aproject:mainfrom
Conversation
Summary of ChangesHello @kabir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an intermittent test failure caused by a race condition in the event queue's polling mechanism. It refactors the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively resolves an intermittent test failure by correcting a race condition. The use of queueManager.awaitQueuePollerStart() instead of Thread.sleep() is a significant improvement for test reliability. The corresponding change in EventQueue to signal the poller start earlier is also a crucial part of the fix. The changes are well-documented in the pull request description. I have a couple of minor suggestions to enhance code consistency and maintainability.
...c/test/java/io/a2a/extras/queuemanager/replicated/tests/KafkaReplicationIntegrationTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/io/a2a/extras/queuemanager/replicated/tests/KafkaReplicationIntegrationTest.java
Show resolved
Hide resolved
…RemoteSubscribers
Two-part fix for race condition in Kafka replication test:
1. EventQueue: Signal polling started BEFORE any early returns
- Moved signalQueuePollerStarted() to beginning of dequeueEventItem()
- Previously in finally block, which didn't execute if queue was closed
- Race: If queue closed before first dequeue, EventQueueClosedException
thrown BEFORE try block, so finally never ran and signal never sent
- Now always signals even if queue immediately throws on closure
2. Test: Replace unreliable Thread.sleep with proper synchronization
- Inject QueueManager to access the queue for the task
- Replace Thread.sleep(2000) with queueManager.awaitQueuePollerStart()
- Ensures EventConsumer is actually polling before sending QueueClosedEvent
- Add debug logging to diagnose future failures
Root cause: signalQueuePollerStarted() was only called in finally block,
which was skipped when queue was already closed at first dequeue attempt.
This caused awaitQueuePollerStart() to hang or timeout intermittently.
…RemoteSubscribers
Two-part fix for race condition in Kafka replication test:
EventQueue: Signal polling started BEFORE any early returns
Test: Replace unreliable Thread.sleep with proper synchronization
Root cause: signalQueuePollerStarted() was only called in finally block, which was skipped when queue was already closed at first dequeue attempt. This caused awaitQueuePollerStart() to hang or timeout intermittently.