He-Pin opened a new pull request, #3262:
URL: https://github.com/apache/pekko/pull/3262

   ### Motivation
   
   When `pekko.log-dead-letters-during-shutdown = off` (which is the 
**default**,
   `reference.conf:63`), dead letters were still logged throughout the entire
   `CoordinatedShutdown` sequence. `DeadLetterListener` had no shutdown 
awareness
   and was only stopped at the very end of shutdown (`finalTerminate`), so every
   dead letter produced while the system was terminating — potentially for the
   whole (and sometimes lengthy) shutdown — was logged unconditionally. The
   setting was effectively ignored until the very last moment.
   
   Fixes #3256.
   
   ### Modification
   
   `DeadLetterListener` now suppresses dead-letter logging while a coordinated
   shutdown **that actually terminates this `ActorSystem`** is in progress, when
   `log-dead-letters-during-shutdown` is disabled.
   
   Crucially, whether the shutdown terminates the system is taken from the
   **effective per-reason** configuration, using the exact same resolution that
   `CoordinatedShutdown` itself uses
   (`CoordinatedShutdown.confWithOverrides(conf, 
shutdownReason()).getBoolean("terminate-actor-system")`).
   This matters because `terminate-actor-system` can be overridden per shutdown
   reason. A coordinated shutdown that does **not** terminate the system 
(globally
   via `terminate-actor-system = off`, or only for a specific reason via
   `reason-overrides`) leaves a shutdown reason set on a still-running system —
   that must **not** suppress logging, otherwise dead-letter logging would be
   silently disabled for the remaining lifetime of the running system.
   
   The `CoordinatedShutdown` extension reference is cached and the effective
   decision is memoized (computed at most once — the shutdown reason is set once
   and never changes), so the per-dead-letter path stays allocation-free and 
cheap
   (a volatile read of the shutdown reason during normal operation, no extension
   lookup).
   
   ### Result
   
   - Dead letters are no longer logged during a **terminating** shutdown when
     `log-dead-letters-during-shutdown = off` — the setting is now honored for 
the
     whole shutdown, not just after the listener is finally stopped.
   - Logging continues normally for a **non-terminating** coordinated shutdown
     (globally or per shutdown reason) and during normal operation.
   - All new members are `private`; **no public API or binary-compatibility
     change** — `actor / mimaReportBinaryIssues` is clean.
   
   ### Tests
   
   - `sbt "actor-tests/testOnly 
org.apache.pekko.event.DeadLetterListenerShutdownSpec"`
     → 4 passed, plus `DeadLetterSupressionSpec` and `DeadLetterSuspensionSpec`
     (no regression).
   - Directional tests (a paused first `CoordinatedShutdown` phase keeps the
     listener alive mid-shutdown) that **fail before the fix**:
     - a terminating shutdown must suppress the dead letter;
     - a non-terminating shutdown (global `terminate-actor-system = off`) must 
keep
       logging;
     - a non-terminating shutdown via a **per-reason override** must keep 
logging
       (this one fails against an earlier base-setting-only gate);
     - logging must continue even after a non-terminating run completes.
   - `sbt "actor/mimaReportBinaryIssues"` → no binary issues.
   
   ### References
   
   Fixes #3256
   
   ---
   
   This is an original contribution to Apache Pekko, made under the Apache 
License
   2.0 (i.e. the changes are now Apache licensed). No third-party or 
Akka-derived
   code is included.
   


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