Skip to content

Fix EventSourcedBehaviorStashSpec flaky failures#2804

Merged
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-stash-spec-fix
Mar 28, 2026
Merged

Fix EventSourcedBehaviorStashSpec flaky failures#2804
He-Pin merged 1 commit intoapache:mainfrom
He-Pin:port-stash-spec-fix

Conversation

@He-Pin
Copy link
Copy Markdown
Member

@He-Pin He-Pin commented Mar 28, 2026

Motivation

EventSourcedBehaviorStashSpec had timing-sensitive assertions that could fail under load.

Modification

Increased timeouts and adjusted assertion patterns to handle variable timing in stash processing.

Result

Stash spec is more reliable in CI environments.

References

  • Upstream commit: akka/akka-core@1c9b1b4116, which is now Apache licensed.
  • Cherry-picked from akka/akka-core v2.8.0 (released Sept 2022, BSL -> Apache 2.0 after 3 years).

Multiple fixes for test flakiness:

- Increase timeout from 5s to 10s for concurrent stash operations that
  produce many events, giving the system enough time under load.
- Change StashLimit.customStashLimit from val to def for proper trait
  initialization order.
- Add thenRun callback to 'start-stashing' persist to confirm write
  completion before sending more commands, preventing race conditions
  where commands are auto-stashed by ESB instead of user stash.
- Wait for 'started-stashing' confirmation in both stash limit tests
  before flooding with commands.

Upstream: akka/akka-core@1c9b1b4116
Cherry-picked from akka/akka-core v2.8.0, which is now Apache licensed.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@He-Pin He-Pin added this to the 2.0.0-M2 milestone Mar 28, 2026
@He-Pin He-Pin marked this pull request as ready for review March 28, 2026 07:10
@He-Pin He-Pin requested review from Philippus and pjfanning March 28, 2026 07:51
@He-Pin He-Pin merged commit 7fef633 into apache:main Mar 28, 2026
9 checks passed
@He-Pin He-Pin deleted the port-stash-spec-fix branch March 28, 2026 09:01
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.

2 participants