MineColonies

MineColonies

57M Downloads

Pathfinding ThreadPoolExecutor doesn't get shutdown

Bricktricker opened this issue ยท 1 comments

commented

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

Steps to reproduce the problem

  1. Start a dedicated server
  2. Play a bit, so villagers use pathfinding
  3. Stop the server with the stop command
  4. The jvm never closes

Verification

  1. 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;
        }
        
    }
  1. Get a thread dump after stoping the server. See that there is only one non-deamon thread running, which is the minecolonies-pathfinding thread.
commented

you're welcome to make a PR to fix said issue if you're capable enough to find it