CoreProtect

CoreProtect

1M Downloads

Config weak map reference for worlds leading to region halts

NahuLD opened this issue ยท 0 comments

commented

FWIW this issue only seems to happen on Folia.

We've been running into an issue that causes region halts that happens with the player quit queues, while attempting to fetch a config reference for a world that might've been unloaded at the time of call (they are dynamically loaded/unloaded).

"Region shutdown thread" #28615 [42313] prio=8 os_prio=0 cpu=1274851.89ms elapsed=1279.94s tid=0x00007f32c81bc260 nid=42313 runnable  [0x00007f331affd000]
   java.lang.Thread.State: RUNNABLE
        at java.util.WeakHashMap.matchesKey([email protected]/Unknown Source)
        at java.util.WeakHashMap.get([email protected]/Unknown Source)
        at net.coreprotect.config.Config.getConfig(Config.java:265)
        at net.coreprotect.listener.player.PlayerQuitListener.queuePlayerQuit(PlayerQuitListener.java:15)
        at net.coreprotect.CoreProtect.safeShutdown(CoreProtect.java:172)
        at net.coreprotect.CoreProtect.onDisable(CoreProtect.java:134)
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:290)
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.disablePlugin(PaperPluginInstanceManager.java:223)
        - locked <0x00007f3750b8a4b0> (a io.papermc.paper.plugin.manager.PaperPluginInstanceManager)
        at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.disablePlugins(PaperPluginInstanceManager.java:147)
        at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.disablePlugins(PaperPluginManagerImpl.java:92)
        at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:528)
        at org.bukkit.craftbukkit.v1_20_R3.CraftServer.disablePlugins(CraftServer.java:576)
        at net.minecraft.server.MinecraftServer.t(MinecraftServer.java:1047)
        at net.minecraft.server.dedicated.DedicatedServer.t(DedicatedServer.java:833)
        at io.papermc.paper.threadedregions.RegionShutdownThread.run(RegionShutdownThread.java:136)

public static Config getConfig(final World world) {
Config ret = CONFIG_BY_WORLD.get(world);
if (ret == null) {
ret = CONFIG_BY_WORLD_NAME.getOrDefault(world.getName(), GLOBAL);
CONFIG_BY_WORLD.put(world, ret);
}
return ret;
}