Skip to content

fix(events): fix intermittent TestEventDispatcherBatchDispatchFail panic - #1798

Open
Thanatos9404 wants to merge 1 commit into
hyperledger-firefly:mainfrom
Thanatos9404:fix/1662-batch-dispatch-fail-flake
Open

Thanatos9404 wants to merge 1 commit into
hyperledger-firefly:mainfrom
Thanatos9404:fix/1662-batch-dispatch-fail-flake

Conversation

@Thanatos9404

@Thanatos9404 Thanatos9404 commented Oct 22, 2026 •

Copy link
Copy Markdown

Proposed changes

TestEventDispatcherBatchDispatchFail started the goroutine that calls bufferedDelivery before registering the GetMessageWithDataCached expectation, so the goroutine could reach the mock first and panic. This registers it first, as TestEventDispatcherBatchBased does. The other tests in this file already set up their mocks before starting bufferedDelivery.

Fixes #1662


Types of changes

  • Bug fix
  • New feature added
  • Documentation Update

Please make sure to follow these points

  • I have read the contributing guidelines.
  • I have performed a self-review of my own code or work.
  • I have commented my code, particularly in hard-to-understand areas.
  • My changes generates no new warnings.
  • I have added tests that prove my fix is effective or that my feature works.
  • My changes have sufficient code coverage (unit, integration, e2e tests).

Other Information

On main the test panicked within 500 runs in each of five attempts on Windows. On Linux it needed load: with twelve copies running at once, nearly every copy panicked within 2,000 runs. With this change it passed 5,000 runs on Windows and 24,000 on Linux under the same load, and internal/events still passes with full coverage.

TestEventDispatcherBatchDispatchFail started the goroutine that calls
bufferedDelivery before registering the GetMessageWithDataCached
expectation. The goroutine could then call the mock while the
expectation was missing or had no return values yet, so the test
panicked (in CI with "no return value specified for
GetMessageWithDataCached"). Register the expectation first, as the
other tests in this file do.

Fixes hyperledger-firefly#1662

Signed-off-by: Yashvardhan Thanvi <yashvt9404@gmail.com>
@Thanatos9404
Thanatos9404 requested a review from a team as a code owner October 22, 2026 03:26

This branch has not been deployed

No deployments
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.

bug: intermittent test failure on event dispatcher

1 participant