Skip to content

fix: killing server during startup crashes it#13755

Open
Strokkur424 wants to merge 1 commit intoPaperMC:dev/26.1from
Strokkur424:fix/unsafe-shutdown-during-startup
Open

fix: killing server during startup crashes it#13755
Strokkur424 wants to merge 1 commit intoPaperMC:dev/26.1from
Strokkur424:fix/unsafe-shutdown-during-startup

Conversation

@Strokkur424
Copy link
Copy Markdown
Member

This pull request fixes a problem often encountered during rapid starting/stopping of servers in debug environments. If you kill the server process, which runs the shutdown hooks, during the server's startup, instead of gracefully shutting down, the server throws an IllegalStateException. This is due to an attempted async save on the player list.

The fix introduced in this PR consists of two parts:

  1. Introduce a new cancelStartup boolean variable, which tells the server to cancel loading/enabling any additional plugins to not waste any time.
  2. Cancel the player list save if cancelStartup is set.

This variable is set at the start of the main shutdown hook. In my testing this correctly ensured that no matter when a server is restarted, it was never exited in an unsafe state (i.e. any world folder locks left due to no cleanup).

@Strokkur424 Strokkur424 requested a review from a team as a code owner April 5, 2026 14:41
@github-project-automation github-project-automation bot moved this to Awaiting review in Paper PR Queue Apr 5, 2026
@Doc94 Doc94 added the dev/next Changes related to the snapshot / next branch label Apr 5, 2026
@kennytv kennytv removed the dev/next Changes related to the snapshot / next branch label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

3 participants