He-Pin opened a new issue, #3256:
URL: https://github.com/apache/pekko/issues/3256

   ### 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`):
   
   1. Line 1111: `terminating = true` — set immediately
   2. Line 1120: `CoordinatedShutdown(this).run(...)` — runs all shutdown phases
   3. **During all phases**: actors stop, messages become dead letters, 
`DeadLetterListener` is **still subscribed and logging**
   4. Phase `actor-system-terminate`: finally calls `finalTerminate()`
   5. Line 1136: listener stopped — **only now**, at the very tail end
   
   **`DeadLetterListener` has no shutdown awareness** 
(`DeadLetterListener.scala:73-79`):
   
   ```scala
   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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to