Pathfinding ThreadPoolExecutor doesn't get shutdown
Bricktricker opened this issue ยท 1 comments
Minecolonies version
Version: minecolonies-0.10.552-BETA-universal
Minecraft: 1.14.4
Forge 28.1.90
Expected behavior
- The dedicated server shuts down normally, when closed with the
stop
command
Actual behaviour
- When shutting down the dedicated server, the jvm doesn't close.
I think the problem is, that the ThreadPoolExecutor for pathfinding
never gets shut down when closing the server, because the created threads are non-daemon threads.
Steps to reproduce the problem
- Start a dedicated server
- Play a bit, so villagers use pathfinding
- Stop the server with the
stop
command - The jvm never closes
Verification
- Add a simple ThreadFactory to the ThreadPoolExecutor:
private static class DebugThreadFactory implements ThreadFactory {
private ThreadFactory defaultFactory;
public DebugThreadFactory() {
this.defaultFactory = Executors.defaultThreadFactory();
}
@Override
public Thread newThread(Runnable r) {
Thread t = this.defaultFactory.newThread(r);
t.setName("minecolonies-pathfinding-" + t.getName());
return t;
}
}
- Get a thread dump after stoping the server. See that there is only one non-deamon thread running, which is the minecolonies-pathfinding thread.