apache / pekko

Build highly concurrent, distributed, and resilient message-driven applications using Java/Scala
https://pekko.apache.org/
Apache License 2.0
1.18k stars 142 forks source link

reproduce issue where stackoverflow happens in unstash #1336

Open pjfanning opened 4 months ago

pjfanning commented 4 months ago

see #1327

This doesn't cause the test to fail or abort - for some reason testkit/scalatest logs the stackoverflow but then claims no tests were run.

Uncaught error from thread [EventSourcedStashOverflowSpec-pekko.actor.default-dispatcher-9]: null, shutting down JVM since 'pekko.jvm-exit-on-fatal-error' is enabled for ActorSystem[EventSourcedStashOverflowSpec]
java.lang.StackOverflowError
    at org.apache.pekko.actor.typed.internal.StashBufferImpl.unstash(StashBufferImpl.scala:206)
[info] Run completed in 3 seconds, 635 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
[info] No tests to run for persistence-typed-tests / Test / testOnly

Without this PR change, the test runs and succeeded: 1 is logged.

pjfanning commented 4 months ago

I have a possible solution but it is breaking quite a few tests so it needs more debugging. It is only one approach but by passing back a behavior wrapping the unstash instead of running the unstash in place - this avoids stack overflow issues. The broken tests show that it is not quite this simple and it may prove to be a dead end.

pjfanning commented 4 months ago

I have a possible solution but it is breaking quite a few tests so it needs more debugging. It is only one approach but by passing back a behavior wrapping the unstash instead of running the unstash in place - this avoids stack overflow issues. The broken tests show that it is not quite this simple and it may prove to be a dead end.

This 'solution' isn't working out.