PaperMC / Paper

The most widely used, high performance Minecraft server that aims to fix gameplay and mechanics inconsistencies
https://papermc.io/
Other
10.04k stars 2.34k forks source link

Changing blocks in onDisable will indefinitely pause the watchdog thread during a crash. #7544

Open Warriorrrr opened 2 years ago

Warriorrrr commented 2 years ago

Expected behavior

The block to be set, and the watchdog thread to not stay paused.

Observed/Actual behavior

The watchdog thread pauses indefinitely, and the plugin that attempted to set the block never finishes shutting down.

Steps/models to reproduce

Reproducible using the code in this gist: https://gist.github.com/Warriorrrr/41345003f00f2482f3abde0335761ca3

The 'changed block' message will never be logged as the thread gets paused after the setType. (latest.log attached below)

Plugin and Datapack List

No plugins aside from the one used to replicate.

Paper version

This server is running Paper version git-Paper-224 (MC: 1.18.2) (Implementing API version 1.18.2-R0.1-SNAPSHOT) (Git: 42a9c37) You are running the latest version

Other

latest.log jstack.txt

Watchdog thread from the jstack: image

kennytv commented 2 years ago

Can you retest on the latest Paper version?

Warriorrrr commented 2 years ago

Retested on version 234, bug still occurs.

lynxplay commented 2 years ago

Replicable with the provided example plugin. The server hangs as the block mutation requests a chunk which is completed on the mainThreadProcessor which, after a long tick time out, dies prior to the execution of the setBlock method.

Warriorrrr commented 2 years ago

I've been looking into this issue a bit myself today, and it seems like throwing an exception if the current thread is the watchdog thread before it tries to complete it on the mainThreadExecutor fixes the issue. Would this be worth PRing, or is there possibly a better solution?