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

   ### Motivation
   `startDefaultLoggers` resolves and creates each configured logger inside a 
single for-comprehension. If entry *N* cannot be resolved, entries *1..N-1* 
have already been created as system actors and initialized, but the `loggers` 
field is only assigned after the whole comprehension succeeds — so the teardown 
path (`stopDefaultLoggers`) never sees them. With `pekko.loggers = [<valid>, 
<invalid>]`, a partially-initialized logging setup outlives the failed 
`ActorSystem` creation: the valid logger actor is neither unsubscribed nor 
stopped.
   
   ### Modification
   - Resolve every logger class first and fail fast before creating any actor.
   - If creating a later logger still fails (e.g. 
`LoggerInitializationException`), stop and unsubscribe the already created ones 
instead of leaking them.
   - New `LoggerSpec` case: a `LifecycleRecordingLogger` configured before an 
unresolvable class; asserts `ConfigurationException` and that the valid logger 
was never started.
   
   ### Result
   No logger actor leaks when `ActorSystem` creation fails due to a bad 
`pekko.loggers` entry.
   
   ### Tests
   - `sbt "actor-tests / Test / testOnly org.apache.pekko.event.LoggerSpec"`: 
12/12 passed
   - Directional check: reverted the fix, re-ran the new test only — failed as 
expected (`true did not equal false`, logger started and leaked)
   - Full validation on CI
   
   ### References
   Fixes #3687


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