Motivation
When log-dead-letters-during-shutdown = off, dead letters are still logged throughout the entire CoordinatedShutdown process. The DeadLetterListener is only stopped at the very end in finalTerminate(), but during all shutdown phases (potentially seconds to minutes), it remains active and logs unconditionally.
Current Behavior
Shutdown sequence (ActorSystem.scala:1110-1138):
- Line 1111:
terminating = true — set immediately
- Line 1120:
CoordinatedShutdown(this).run(...) — runs all shutdown phases
- During all phases: actors stop, messages become dead letters,
DeadLetterListener is still subscribed and logging
- Phase
actor-system-terminate: finally calls finalTerminate()
- Line 1136: listener stopped — only now, at the very tail end
DeadLetterListener has no shutdown awareness (DeadLetterListener.scala:73-79):
private def receiveWithAlwaysLogging: Receive = {
case d: AllDeadLetters =>
if (!isWrappedSuppressed(d)) {
incrementCount()
logDeadLetter(d, doneMsg = "")
}
}
No check for isTerminating() or the LogDeadLettersDuringShutdown setting. All receive variants log unconditionally until the actor is stopped.
Expected Behavior
The DeadLetterListener should check context.system.isTerminating() (which returns true from the moment terminate() is called) and suppress logging when LogDeadLettersDuringShutdown = off, throughout the entire shutdown process — not just after finalTerminate.
Environment
- Pekko Actor (any version)
ActorSystem.scala:1133-1138, DeadLetterListener.scala:73-79
References
None
Motivation
When
log-dead-letters-during-shutdown = off, dead letters are still logged throughout the entire CoordinatedShutdown process. TheDeadLetterListeneris only stopped at the very end infinalTerminate(), but during all shutdown phases (potentially seconds to minutes), it remains active and logs unconditionally.Current Behavior
Shutdown sequence (
ActorSystem.scala:1110-1138):terminating = true— set immediatelyCoordinatedShutdown(this).run(...)— runs all shutdown phasesDeadLetterListeneris still subscribed and loggingactor-system-terminate: finally callsfinalTerminate()DeadLetterListenerhas no shutdown awareness (DeadLetterListener.scala:73-79):No check for
isTerminating()or theLogDeadLettersDuringShutdownsetting. All receive variants log unconditionally until the actor is stopped.Expected Behavior
The
DeadLetterListenershould checkcontext.system.isTerminating()(which returnstruefrom the momentterminate()is called) and suppress logging whenLogDeadLettersDuringShutdown = off, throughout the entire shutdown process — not just afterfinalTerminate.Environment
ActorSystem.scala:1133-1138,DeadLetterListener.scala:73-79References
None