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
akka-persistence-typed is loosing commands received while snapshots are created #27381
Comments
Thanks for taking the time to create a reproducer @IainHull I'll take a look into this |
I was able to re-create this in a smaller test, when sashing messages while saving a snapshot the commands go into the user stash rather than the internal stash that is automatically unstashed |
* Fix stashing of commands when snapshot is in progress Fixes #27381 * Naming
* Fix stashing of commands when snapshot is in progress Fixes #27381 * Naming
Thanks a million for the quick work. If I can help back porting just tell me what to do or point me at some docs. |
Thanks for the great issue and reproducer!
Backporting was already succesful in #27415, so the next release of Akka 2.5 (not yet planned) and the next milestone release of Akka 2.6 (expected very soon) should contain the fix. The nightlies at https://repo.akka.io/snapshots/ (i.e. https://repo.akka.io/snapshots/com/typesafe/akka/akka-actor_2.12/2.5-20190725-210209/) should also have it. |
* Fix stashing of commands when snapshot is in progress Fixes akka#27381 * Naming
When simulating large amounts of traffic in an application built on top of akka-persistence-typed it seems to loose commands sent to persistent actors when they are storing snapshots.
I have created a small repository to reproduce this bug https://github.com/IainHull/akka-persistence-message-bug
Using a logging interceptor around the persistent actor all messages entering the behavior are logged. The persistent actor also logs all commands processed by the
commandHandler
and each time the function sent tosnapshotWhen
returns true. With these we can see some messages sent to the persistent actor and logged by the interceptor while the snapshot is being written never make it to thecommandHandler
.io.github.iainhull.bug.Application
, run this it will stop once it has reproduced the bug.TestActor
to sends 100s ofRegisterValue
commands to thePersistentActor
.PersistentActor
withGetState
requests to verified that all values have been received.RegisterValue
are missing or theGetState
ask times out.Here is a sample from logs on my machine where an ask command
GetState
times out:ValueRegistered
events are processed in less than one second.PersistentActor
decides to write a snapshotLets snapshot 10 ValueRegistered(9) 10
PersistentActor
logging interceptor receives the next messageIntercepted message: GetState
. This is a requestusing the ask pattern.
PersistentActor
completes snapshotReceived signal SnapshotCompleted(SnapshotMetadata(persistence,10,1563490204147))
TestActor
gets ``Ask failure java.util.concurrent.TimeoutException: Ask timed out on [Actor[akka://app/user/persistence#-163712343]] after [15000 ms]. Message of type [io.github.iainhull.bug.PersistentActor$GetState]. A typical reason forAskTimeoutException
is that the recipient actor didn't send a reply.`Intercepted message
log in thePersistentActor
has a matchingReceived command
log except this oneThe command handler never got this message.
The text was updated successfully, but these errors were encountered: