Conversation
This fixes a race where a late log message to the async appender could cause console reinitialization during shutdown
This ensures any plugin log messages holding classloader scoped context get printed before the classloader is closed, avoiding certain plugin errors being unloggable.
|
Last updated for: 17a34a8bc08925b4c2f6c413b2f2013b7f64a390. Download the Paperclip jar for this pull request: paper-13622.zip Maven PublicationThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven("https://maven-prs.papermc.io/Paper/pr13622") {
name = "Maven for PR #13622" // https://github.com/PaperMC/Paper/pull/13622
mavenContent {
includeModule("io.papermc.paper", "dev-bundle")
includeModule("io.papermc.paper", "paper-api")
}
}
} |
There was a problem hiding this comment.
Pull request overview
Improves shutdown-time logging behavior to avoid races with Log4j async logging and plugin-classloader-scoped log messages during plugin disable/unload.
Changes:
- Adds an explicit
flush(timeout, unit)API to Log4j’sAsyncAppendervia a Paper patch. - Flushes Log4j async appenders during plugin disable before unloading plugin classloaders.
- Moves/removes some shutdown-time logging cleanup steps from
MinecraftServershutdown flow intoLogManagerShutdownThread.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
paper-server/src/main/java/io/papermc/paper/util/LogManagerShutdownThread.java |
Adds additional shutdown cleanup (force reset + terminal console close) around Log4j shutdown. |
paper-server/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java |
Flushes Log4j async appenders during plugin disable to prevent late log processing after classloader close. |
paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch |
Removes terminal console close + log manager reset from the server’s shutdown routine. |
paper-server/patches/features/0032-Add-explicit-flush-support-to-Log4j-AsyncAppender.patch |
Introduces explicit flush support to Log4j async logging internals. |
paper-server/patches/features/0028-Optimize-Hoppers.patch |
Patch metadata/index adjustment only. |
paper-server/patches/features/0025-Optimise-EntityScheduler-ticking.patch |
Patch metadata/index adjustment only. |
paper-server/patches/features/0020-Incremental-chunk-and-player-saving.patch |
Patch metadata/index adjustment only. |
paper-server/patches/features/0001-Moonrise-optimisation-patches.patch |
Patch metadata/index adjustment only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
paper-server/src/main/java/io/papermc/paper/util/LogManagerShutdownThread.java
Outdated
Show resolved
Hide resolved
paper-server/patches/sources/net/minecraft/server/MinecraftServer.java.patch
Show resolved
Hide resolved
paper-server/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
Outdated
Show resolved
Hide resolved
paper-server/src/main/java/io/papermc/paper/plugin/manager/PaperPluginInstanceManager.java
Show resolved
Hide resolved
paper-server/patches/features/0032-Add-explicit-flush-support-to-Log4j-AsyncAppender.patch
Outdated
Show resolved
Hide resolved
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.
This fixes a race where a late log message to the async appender could cause console reinitialization during shutdown
Also fixes issues when plugin log messages with classloader scoped context tries to print after the plugin classloader is closed by flushing the async appender as a part of disabling plugins.