mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
2f74bdb56b
The watchdog thread calls the server restart function asynchronously. Prior to this change, it attempted to do several non-safe operations from the watchdog thread, rather than the main. Specifically, because of a separate upstream change, it causes player entities to be ticked asynchronously, among other things. This is dangerous. This patch moves the old handling into a synchronous variant, for calls from the restart command, and adds separate handling for async calls, such as those from the watchdog thread. When calling from the watchdog thread, we cannot assume the main thread is in a tickable state; it may be completely deadlocked. In order to handle this, we mark the server as stopping, in order to account for situations where the server should complete a tick reasonbly soon, i.e. 99% of cases. Should the server not enter a state where it is stopping within 10 seconds, We will assume that the server has in fact deadlocked and will proceed to force kill the server. This modification does not force restart the server should we actually enter a deadlocked state where the server is stopping, whereas this will in most cases exit within a reasonable amount of time, to put a fixed limit on a process that will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. |
||
---|---|---|
.. | ||
sources |