After noticing the dedicated server wouldn't fully shutdown I narrowed it down to the selling bin mod. By pressing CTRL + BREAK on a server that was not shutting down to get the thread dump, "Timer-1" was pretty much the only not daemon thread still running and waiting.
"Timer-1" #80 [22996] prio=5 os_prio=0 cpu=0.00ms elapsed=187.41s tid=0x000001a2a71d3e80 nid=22996 in Object.wait() [0x000000601d8ff000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait0(java.base@21.0.3/Native Method)
- waiting on <0x000000060101b7c0> (a java.util.TaskQueue)
at java.lang.Object.wait(java.base@21.0.3/Object.java:366)
at java.util.TimerThread.mainLoop(java.base@21.0.3/Timer.java:563)
- locked <0x000000060101b7c0> (a java.util.TaskQueue)
at java.util.TimerThread.run(java.base@21.0.3/Timer.java:516)
I couldn't find the sourcecode for the mod so I decompiled and edited it using Recaf.
The only change I made was in SellingBinMod.java making a Timer object's associated threads run as daemon Timer(true).
Object e = new Timer(true);
e.scheduleAtFixedRate(new TimerTask() {
public void run() {
SellingBinMod.inventoryManager.save(SellingBinMod.inventoryFile);
}
}, 0L, 600000L);
This fixed the issue, and as far as my limited testing showed had no impact on the mod's functionality.
This maybe isn't the best fix, I think you could maybe put a e.cancel() in your shutdownThread closing the thread gracefully. But I couldn't get the decompiled files to run so I had to make do with smallest change I could make changing bytecode.
After noticing the dedicated server wouldn't fully shutdown I narrowed it down to the selling bin mod. By pressing CTRL + BREAK on a server that was not shutting down to get the thread dump, "Timer-1" was pretty much the only not daemon thread still running and waiting.
I couldn't find the sourcecode for the mod so I decompiled and edited it using Recaf. The only change I made was in SellingBinMod.java making a Timer object's associated threads run as daemon
Timer(true)
.This fixed the issue, and as far as my limited testing showed had no impact on the mod's functionality. This maybe isn't the best fix, I think you could maybe put a
e.cancel()
in your shutdownThread closing the thread gracefully. But I couldn't get the decompiled files to run so I had to make do with smallest change I could make changing bytecode.Hope this helps :)