Skip to content

Eventsourced.persist misbehaves invoked from within RecoveryCompleted #22609

@minisaw

Description

@minisaw

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions