Repository navigation
Conversation
LoggerContext.start(Configuration) registered the JVM shutdown hook before setConfiguration installed that configuration. The hook copied shutdownTimeoutMillis from the DefaultConfiguration still in place, which is 0, so a configured shutdownTimeout did not reach stop. Pass the configuration being started into setUpShutdownHook. The no-arg start() still passes the configuration installed by reconfigure(). LoggerContextShutdownHookTimeoutTest failed on the unfixed core with expected 5000 but was 0, and passed after the fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LoggerContext.start(Configuration)registers the JVM shutdown hook beforesetConfigurationinstalls that configuration. The hook copiedshutdownTimeoutMillisfrom theDefaultConfigurationstill in place, which is 0.ExecutorServices.shutdowndoes not wait when the timeout is 0, so a configuredshutdownTimeoutwas ignored on JVM exit.start()with no arguments still callsreconfigure()first and then registers the hook, so that path already used the installed configuration.AsyncLoggerContext.start(Configuration)callssuper.start(config)and picks up this change.On
2.x,start(Configuration)callsreconfigure(config)before the hook is registered, so this regression is onmainonly. Introduced whensetConfiguration(config)stayed after the hook registration (02560820ef, Ralph Goers, 2013) and the timeout snapshot was added in705e27253c(Mikael Staldal, 2016). The Log4j 3 reorder never moved the snapshot onto the configuration argument.Test plan
LoggerContextShutdownHookTimeoutTestagainst unfixedlog4j-corefailed withexpected: <5000> but was: <0>./mvnw -pl log4j-core,log4j-core-test spotless:apply