pekko/persistence-typed-tests/src/test
Tomassino-ibm d89f2eec8b
Fix typed persistence stack overflow with many read only commands (#1919)
* Update unstash stack overflow test to have it actually fail

Taken changes from https://github.com/apache/pekko/pull/1336 to have a test that fails

* Fix possible stack overflow in persistence-typed

This commit adds code to break recurrent calls in persistence-typed while unstashing read-only commands that could lead to a stack overflow, fixing issue #1327 (limited to EventSourcedBehavior)

The fix can be enabled using a feature flag, by default it is disabled

* bin compat exclude and scalafmt

* Also fix the same stack overflow issue in DurableStateBehavior

The fix is enabled by the same feature flag used by the fix of EventSourcedBehavior

* Enable by default the fix for the stack overflow

Also rename parameter

* Refactor code to make it more explicit that the old code path is unchanged

This commit changes how `onMessage` and `onCommand` are implemented to make it clearer that, when the `recurse-when-unstashing-read-only-commands` flag is set to true, the old code path is used.

Moreover, the while loop in onCommand has been changed into a tail recursive function

These changes have been applied to both EventSourcedBehavior and DurableStateBehavior

---------

Co-authored-by: PJ Fanning <pjfanning@users.noreply.github.com>
2025-07-11 10:32:43 +01:00
..
java adjust ASF header (#450) 2023-06-22 14:19:26 +01:00
resources replace akka based names in logging code (#197) 2023-02-16 10:46:33 +01:00
scala Fix typed persistence stack overflow with many read only commands (#1919) 2025-07-11 10:32:43 +01:00