You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "He-Pin (via GitHub)" <gi...@apache.org> on 2026/06/27 23:45:00 UTC
[I] PersistentActor enters infinite restart loop when RecoveryCompleted handler throws [pekko]
He-Pin opened a new issue, #3249:
URL: https://github.com/apache/pekko/issues/3249
### Motivation
When a classic `PersistentActor`'s `RecoveryCompleted` handler throws an exception, the actor enters an infinite restart loop instead of stopping. This is inconsistent with every other recovery failure path, which all explicitly call `context.stop(self)`.
### Current Behavior
In `Eventsourced.scala:786-814`, when `RecoveryCompleted` handler throws:
1. `finally transitToProcessingState()` runs — changes state
2. Exception propagates to outer `catch` which calls `returnRecoveryPermit()` and rethrows
3. **No `context.stop(self)`** is called
4. **No `onRecoveryFailure()` callback** is invoked
5. Default supervision (`Restart` with unlimited retries) causes infinite restart loop
6. Same journal events replayed → same exception → forever
### Comparison with Other Recovery Failure Paths
| Failure Scenario | `onRecoveryFailure()` | `context.stop(self)` | Result |
|---|---|---|---|
| `ReplayedMessage` throws | Yes | Yes | Actor stops |
| `ReplayMessagesFailure` | Yes | Yes | Actor stops |
| `RecoveryTick` timeout | Yes | Yes | Actor stops |
| **`RecoveryCompleted` throws** | **No** | **No** | **Restart loop** |
### Expected Behavior
The `RecoveryCompleted` failure path should be consistent with other recovery failure paths — call `onRecoveryFailure()` and `context.stop(self)` to prevent the infinite restart loop.
### Reproduction
Confirmed by existing test `RecoveryPermitterSpec.scala:174-197` which observes 5 consecutive restarts and must manually call `system.stop()` to break the loop.
### Environment
- Pekko Persistence (any version)
- `Eventsourced.scala:786-814`
### References
None
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org
Re: [I] PersistentActor enters infinite restart loop when RecoveryCompleted handler throws [pekko]
Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin closed issue #3249: PersistentActor enters infinite restart loop when RecoveryCompleted handler throws
URL: https://github.com/apache/pekko/issues/3249
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org