Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: EventSourcedBehaviorStashSpec failure fixes #31808

Conversation

johanandren
Copy link
Member

References #31493

Could repeat the two different failures (and one more) by delaying completion of the in-mem journal writes some 20ms

// a lot of events, so give it some extra time to complete
val value1 = stateProbe.expectMessageType[State](10.seconds).value
val value2 = stateProbe.expectMessageType[State](10.seconds).value
val value3 = stateProbe.expectMessageType[State](10.seconds).value
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test case simply writes a lot of events, giving it more time fixed the issue

@@ -528,7 +529,7 @@ class EventSourcedBehaviorStashSpec
}

trait StashLimit {
val customStashLimit: Option[Int] = None
def customStashLimit: Option[Int]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a little code-style-fix making it more clear what is going on

val c = spawn(behavior)

// make sure it completed recovery, before we try to overfill the stash
c ! "ping"
probe.expectMessage("pong")

c ! "start-stashing"
probe.expectMessage("started-stashing")
Copy link
Member Author

@johanandren johanandren Jan 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests triggered started-stashing and then piled up messages without waiting for that to complete, so they end up in the non-explicit stash because of the write being in progress leading to the "unstash" message also having to be put in the stash buffer, which is at that point full.

Fixed by waiting for completion/response from the stash-state-toggle first.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add this comment to the source code :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in ee983a6

val c = spawn(behavior)

// make sure it completed recovery, before we try to overfill the stash
c ! "ping"
probe.expectMessage("pong")

c ! "start-stashing"
probe.expectMessage("started-stashing")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add this comment to the source code :)

@johanandren johanandren merged commit 1c9b1b4 into akka:main Jan 9, 2023
@johanandren johanandren deleted the wip-31493-EventSourcedBehaviorStashSpec-fail branch January 9, 2023 08:20
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.

3 participants