PaperMC / PaperMC/Paper

watchdog server kill froze server because of exception

Open
#11,072 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs testing version: 1.21
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Stack trace
[17:42:30] [Paper Watchdog Thread/INFO]: Stopping main thread (Ignore any thread death message you see! - DO NOT REPORT THREAD DEATH TO PAPER)
[17:42:30] [Paper Watchdog Thread/INFO]: Stopping server
[17:42:30] [Paper Watchdog Thread/INFO]: Saving players
[17:42:30] [Paper Watchdog Thread/WARN]: Asynchronous Save Players! Blocking thread until it returns 
java.lang.IllegalStateException: null
	at io.papermc.paper.util.MCUtil.ensureMain(MCUtil.java:350) [?:1.21-DEV-0e02aa5]
	at net.minecraft.server.players.PlayerList.h(PlayerList.java:1185) [?:1.21-DEV-0e02aa5]
	at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1060) [?:1.21-DEV-0e02aa5]
	at net.minecraft.server.dedicated.DedicatedServer.v(DedicatedServer.java:845) [?:1.21-DEV-0e02aa5]
	at net.minecraft.server.MinecraftServer.close(MinecraftServer.java:1006) [?:1.21-DEV-0e02aa5]
	at org.spigotmc.WatchdogThread.run(WatchdogThread.java:231) [?:1.21-DEV-0e02aa5]
Plugin and Datapack List

not relevant

Actions to reproduce (if known)

Sleep in the main thread for over 10 seconds then paper kills the server and the exception occurs

Paper version

[13:17:25 INFO]: Checking version, please wait...
[13:17:25 INFO]: This server is running Paper version 1.21-DEV-master@2288e13 (2024-07-13T21:34:15Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21-DEV-5a503d7 (MC: 1.21)
We use the reobf version so its selfbuild, but this is 1.21-63

Other

this error occurs because the PaperWatchdogThread (which kills / stop the server) is not the main tick thread

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stack trace and the reported reproduction: sleep on the main thread for over 10 seconds. Read org/spigotmc/WatchdogThread.java, io/papermc/paper/util/MCUtil.java, and the referenced MinecraftServer and PlayerList methods to understand the shutdown path. Done means the watchdog-triggered shutdown no longer freezes or raises this main-thread exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.