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

Eventsourced.persist misbehaves invoked from within RecoveryCompleted #22609

Closed
minisaw opened this issue Mar 20, 2017 · 5 comments
Closed

Eventsourced.persist misbehaves invoked from within RecoveryCompleted #22609

minisaw opened this issue Mar 20, 2017 · 5 comments
Milestone

Comments

@minisaw
Copy link

minisaw commented Mar 20, 2017

akka.persistence.Eventsourced.persist javadoc documentation states:

It is guaranteed that no new commands will be received by a persistent actor between a call to persist and the execution of its handler.

However, in case an event is persisted from within the RecoveryCompleted message handler, the statement above does not hold. The following sequence of events happens:

  1. upon creation, the actor's receiveRecover handler gets the RecoveryCompleted message.
  2. in RecoveryCompleted message handler, persist an event E
  3. send a message X to the actor
  4. the actor's receiveCommand handler receives the message X, processes it
  5. only then the E's handler is invoked

While according to the specification, bullet number 4 must have occurred only after bullet 5.

A test application showcasing the issue is available at https://github.com/minisaw/akka-persistence-test

also another mention of the same problem:
https://stackoverflow.com/questions/36649466/akka-persist-on-recovery-completed-updates-state-after-first-message

@patriknw
Copy link
Member

@minisaw Could this be a duplicate of #21736 ?

@minisaw
Copy link
Author

minisaw commented Mar 20, 2017

it appears to be.

@minisaw
Copy link
Author

minisaw commented Mar 20, 2017

there's one more quirk, though: the event handler will not be invoked at all in case no message is sent to the actor. so the problem is not only in that the commands are not stashed (as #21736 states).

@patriknw
Copy link
Member

so #21893 is not covering everything?

@minisaw
Copy link
Author

minisaw commented Aug 31, 2017

works in 2.4.18, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants