Repository navigation
Commit 8cecf70
committed
fix: Eliminate intermittent failure in testQueueClosedEventTerminatesRemoteSubscribers
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.1 parent 3dfa2bf commit 8cecf70
2 files changed
Lines changed: 40 additions & 26 deletions
File tree
- extras/queue-manager-replicated/tests-single-instance/src/test/java/io/a2a/extras/queuemanager/replicated/tests
- server-common/src/main/java/io/a2a/server/events
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
68 | 71 | | |
69 | 72 | | |
70 | 73 | | |
| |||
367 | 370 | | |
368 | 371 | | |
369 | 372 | | |
370 | | - | |
371 | | - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
372 | 378 | | |
373 | 379 | | |
374 | 380 | | |
| |||
384 | 390 | | |
385 | 391 | | |
386 | 392 | | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
387 | 401 | | |
388 | 402 | | |
389 | 403 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
662 | 662 | | |
663 | 663 | | |
664 | 664 | | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
665 | 669 | | |
666 | 670 | | |
667 | 671 | | |
| |||
672 | 676 | | |
673 | 677 | | |
674 | 678 | | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
683 | 684 | | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
698 | 695 | | |
699 | | - | |
700 | | - | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
701 | 701 | | |
702 | 702 | | |
703 | 703 | | |
| |||
0 commit comments