Repository navigation
Do not report halted regions in the watchdog - #515
Open
lewisgibson wants to merge 2 commits into
Open
lewisgibson wants to merge 2 commits into
lewisgibson wants to merge 2 commits into
Conversation
The watchdog dereferenced the result of getThreadInfo, which is null once a halted region thread has exited. See the patch for details.
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.
When the server stops, the region scheduler halts its threads, and a tick that was running on one of them can still be registered with
FoliaWatchdogThread. Once the tick is older than five seconds the watchdog prints "has not responded" and callsWatchdogThread#dumpThreadwith the result ofThreadMXBean#getThreadInfo, which is null for a thread that has exited. That throws a NullPointerException and the Folia Watchdog Thread dies.The
ThreadInfois now fetched before anything is printed and the tick is skipped if it is null. The change is in0008-Add-watchdog-thread.patch, which owns the file.I could not make a real stop hit this, the window is a few milliseconds. To check the code path I used a small test plugin that registers a tick that started 10 seconds ago on a thread that has already exited, which is the state a halted region leaves behind. On an unpatched build the watchdog thread dies with
NullPointerException: Cannot invoke "java.lang.management.ThreadInfo.getThreadName()" because "thread" is null. With this change nothing is printed and the watchdog thread is still alive 4 seconds later.This also happens on a normal
stopwith an unmodified build. From official Folia 26.2 build 7 (26.2-7-14b7fee), after the scheduler had already halted and while the server was still shutting down, sohasStopped()was still false:This was done with AI (Claude Opus 5.5 and GPT Astra, high effort). I've reviewed it and tested it myself.