Class DispatchFailureReporting$

java.lang.Object
org.apache.pekko.dispatch.DispatchFailureReporting$

public class DispatchFailureReporting$ extends Object
INTERNAL API

Reporting a dispatch failure means publishing to the EventStream, which delivers to a logging actor with ! and therefore goes back through dispatch. When the executor is rejecting - during shutdown, or behind a saturated queue - that re-enters the failure path and recurses until the stack overflows, which pekko.jvm-exit-on-fatal-error turns into a JVM kill.

Reporting is guarded per thread: the outermost failure publishes to the EventStream as before, and a failure reached while that publish is still in flight goes to the stdout logger, which has no mailbox and so cannot re-enter dispatch. See https://github.com/apache/pekko/issues/3613.

The guard is a concurrent set of threads rather than a ThreadLocal. A virtualized dispatcher runs every task on a new virtual thread, and ThreadLocal.get allocates a ThreadLocalMap on a thread that does not have one yet - which is why Dispatcher.batchable turns batching off when virtualized. Entries live only for the duration of one publish and are removed in finally.

  • Field Details

    • MODULE$

      public static final DispatchFailureReporting$ MODULE$
      Static reference to the singleton instance of this Scala object.
  • Constructor Details

    • DispatchFailureReporting$

      public DispatchFailureReporting$()
  • Method Details