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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
