xCykrix / DynamicLights

Spigot/Paper Plugin for Simple Dynamic Lights
https://www.spigotmc.org/resources/dynamiclights.110707/
5 stars 1 forks source link

[BUG] Race condition when creating a folder vs writing to it by adding a file. #3

Closed lylesnake closed 1 year ago

lylesnake commented 1 year ago

Hi, I like your plugin idea and tried downloading it. The console gave me these two errors when I tried starting it back up. Thought you'd want to know

[Server] [ERROR] Error occurred while enabling DynamicLights v1.0.0-SNAPSHOT (Is it up to date?) 24.06 11:11:59 [Server] [INFO] java.lang.IllegalArgumentException: Directory does not exist: nio:plugins/DynamicLights [1.4.186/0] 24.06 11:11:59 [Server] [INFO] at com.shaded._100.org.h2.mvstore.DataUtils.newIllegalArgumentException(DataUtils.java:736) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at com.shaded._100.org.h2.mvstore.FileStore.open(FileStore.java:143) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at com.shaded._100.org.h2.mvstore.MVStore.(MVStore.java:340) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at com.shaded._100.org.h2.mvstore.MVStore$Builder.open(MVStore.java:2785) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at com.github.xcykrix.plugincommon.api.H2MVStoreAPI.initialize(H2MVStoreAPI.java:19) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at com.github.xcykrix.plugincommon.PluginCommon.onEnable(PluginCommon.java:28) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:281) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:189) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:562) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:473) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:435) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1101) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at java.lang.Thread.run(Thread.java:833) ~[?:?] 24.06 11:11:59 [Server] [INFO] [DynamicLights] Disabling DynamicLights v1.0.0-SNAPSHOT 24.06 11:11:59 [Server] [ERROR] Error occurred (in the plugin loader) while disabling DynamicLights v1.0.0-SNAPSHOT (Is it up to date?) 24.06 11:11:59 [Server] [INFO] java.lang.NullPointerException: Cannot invoke "com.shaded._100.org.h2.mvstore.MVStore.close()" because "this.store" is null 24.06 11:11:59 [Server] [INFO] at com.github.xcykrix.plugincommon.api.H2MVStoreAPI.shutdown(H2MVStoreAPI.java:24) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at com.github.xcykrix.plugincommon.PluginCommon.onDisable(PluginCommon.java:54) ~[DynamicLights-1.0.0-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:283) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.disablePlugin(PaperPluginInstanceManager.java:224) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.disablePlugin(PaperPluginManagerImpl.java:109) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:537) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at io.papermc.paper.plugin.manager.PaperPluginInstanceManager.enablePlugin(PaperPluginInstanceManager.java:193) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at io.papermc.paper.plugin.manager.PaperPluginManagerImpl.enablePlugin(PaperPluginManagerImpl.java:104) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:507) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?] 24.06 11:11:59 [Server] [INFO] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugin(CraftServer.java:562) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at org.bukkit.craftbukkit.v1_20_R1.CraftServer.enablePlugins(CraftServer.java:473) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:636) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:435) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:308) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1101) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318) ~[paper-1.20.1.jar:git-Paper-"837cc25"] 24.06 11:11:59 [Server] [INFO] at java.lang.Thread.run(Thread.java:833) ~[?:?]

xCykrix commented 1 year ago

Thanks. I'll take a look at this today and try to patch it with v1.0.1 with the other two bugs I've identified.

xCykrix commented 1 year ago

@lylesnake Issue should be resolved in v1.0.1. Closing this issue for now.

Please let me know if you encounter this error again by commenting back, or any other errors in a new issue. This is a beta run from my private survival multiplayer so there are some issues that were not found in development. I'll get them all sorted out as they appear, however.

xCykrix commented 1 year ago

https://github.com/xCykrix/DynamicLights/releases/tag/v1.0.1

lylesnake commented 1 year ago

Whatever you did in this update fixed it! It works like a dream. Excellent plugin. Thank you!!

xCykrix commented 1 year ago

It was due to a race condition on the plugins/DynamicLights folder being created vs a file being created inside of it. I already had the folder on my development server, which is why I didn't receive the error in testing.

Happy that it is fixed! If you have any other problems, please feel free to submit a new issue and I'll be happy to fix whatever you come across!

I'll also be adding some additional customization options such as the ability to configure the locking mode (used for when people are mining and trying to eat with their off-hand light source. So you can keep an eye for that on Spigot.