* 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>