LuckPerms: Symbolic link for yaml-storage gives java.nio.file.FileAlreadyExistsException

Ahoy!

I have a few servers on the same machine with split storage

split-storage:
  enabled: true
  methods:
    user: MySQL
    group: yaml
    track: yaml
    uuid: MySQL
    log: MySQL

Its much, much easier to manage permissions using flatfiles while keeping user data and logs in MySQL, the only issue I have is with multiple servers having their own Groups in YAML it gets very messy when updating and changing plugins on one server, and having to copy them over to another, the simplest solution I could think of was a Symbolic link for the yaml-storage folder to the other server so then I could edit one set of permissions and set per-server or per-world in this one set of permissions!

Sadly when booting the second server, it threw a bunch of errors;

[16:43:17] [Server thread/INFO]: [LuckPerms] Loading configuration...
[16:43:18] [Server thread/INFO]: [LuckPerms] Loading storage provider... [SPLIT STORAGE]
[16:43:18] [Server thread/WARN]: java.nio.file.FileAlreadyExistsException: /home/user/folder/plugins/LuckPerms/yaml-storage
[16:43:18] [Server thread/WARN]: 	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
[16:43:18] [Server thread/WARN]: 	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[16:43:18] [Server thread/WARN]: 	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
[16:43:18] [Server thread/WARN]: 	at java.base/sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:389)
[16:43:18] [Server thread/WARN]: 	at java.base/java.nio.file.Files.createDirectory(Files.java:689)
[16:43:18] [Server thread/WARN]: 	at java.base/java.nio.file.Files.createAndCheckIsDirectory(Files.java:796)
[16:43:18] [Server thread/WARN]: 	at java.base/java.nio.file.Files.createDirectories(Files.java:742)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.util.MoreFiles.createDirectoriesIfNotExists(MoreFiles.java:57)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.implementation.file.AbstractConfigurateStorage.init(AbstractConfigurateStorage.java:159)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.implementation.file.SeparatedConfigurateStorage.init(SeparatedConfigurateStorage.java:151)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.implementation.split.SplitStorage.init(SplitStorage.java:86)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.Storage.init(Storage.java:115)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.StorageFactory.getInstance(StorageFactory.java:88)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.plugin.AbstractLuckPermsPlugin.enable(AbstractLuckPermsPlugin.java:146)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.bukkit.LPBukkitBootstrap.onEnable(LPBukkitBootstrap.java:161)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:395)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:344)
[16:43:18] [Server thread/WARN]: 	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:223)
[16:43:18] [Server thread/WARN]: 	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616)
[16:43:18] [Server thread/WARN]: 	at java.base/java.lang.Thread.run(Thread.java:834)
[16:43:18] [Server thread/INFO]: [me.lucko.luckperms.lib.hikari.HikariDataSource] luckperms-hikari - Starting...
[16:43:18] [Server thread/INFO]: [me.lucko.luckperms.lib.hikari.HikariDataSource] luckperms-hikari - Start completed.
[16:43:18] [Server thread/ERROR]: [LuckPerms] Failed to init storage implementation
[16:43:18] [Server thread/WARN]: java.lang.RuntimeException: One of the backings failed to init
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.implementation.split.SplitStorage.init(SplitStorage.java:93)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.Storage.init(Storage.java:115)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.StorageFactory.getInstance(StorageFactory.java:88)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.plugin.AbstractLuckPermsPlugin.enable(AbstractLuckPermsPlugin.java:146)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.bukkit.LPBukkitBootstrap.onEnable(LPBukkitBootstrap.java:161)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:316)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:405)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:395)
[16:43:18] [Server thread/WARN]: 	at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:344)
[16:43:18] [Server thread/WARN]: 	at net.minecraft.server.v1_12_R1.DedicatedServer.init(DedicatedServer.java:223)
[16:43:18] [Server thread/WARN]: 	at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:616)
[16:43:18] [Server thread/WARN]: 	at java.base/java.lang.Thread.run(Thread.java:834)
[16:43:18] [Server thread/INFO]: [LuckPerms] Loading messaging service... [BUNGEE]
[16:43:18] [Server thread/INFO]: [LuckPerms] Loading internal permission managers...
[16:43:18] [Server thread/INFO]: [LuckPerms] Performing initial data load...
[16:43:18] [Server thread/WARN]: java.util.concurrent.CompletionException: java.lang.NullPointerException
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1739)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1728)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[16:43:18] [Server thread/WARN]: Caused by: java.lang.NullPointerException
[16:43:18] [Server thread/WARN]: 	at java.base/java.nio.file.Files.provider(Files.java:100)
[16:43:18] [Server thread/WARN]: 	at java.base/java.nio.file.Files.newDirectoryStream(Files.java:471)
[16:43:18] [Server thread/WARN]: 	at java.base/java.nio.file.Files.list(Files.java:3698)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.implementation.file.SeparatedConfigurateStorage.loadAllGroups(SeparatedConfigurateStorage.java:287)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.implementation.split.SplitStorage.loadAllGroups(SplitStorage.java:173)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.Storage.lambda$loadAllGroups$10(Storage.java:195)
[16:43:18] [Server thread/WARN]: 	at me.lucko.luckperms.common.storage.Storage.lambda$makeFuture$1(Storage.java:99)
[16:43:18] [Server thread/WARN]: 	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
[16:43:18] [Server thread/WARN]: 	... 6 more
[16:43:19] [Server thread/INFO]: [LuckPerms] Successfully enabled. (took 1177ms)

Searching for java.nio.file.FileAlreadyExistsException gives me this stack overflow which says that its when the same file is already open in another thread. https://stackoverflow.com/a/43669557/381907

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Symlinks were already somewhat supported - must be something unique about your setup which is causing that error to occur… anyway, should be resolved by the above commit.

Or scrap all that and fix symbolic links which was my initial report, I use Symbolic links with DynMap with no issues.

they need to stay as flatfile

No they don’t. You’d be the first person ever to actually need to use YAML.
I mean you’re trying to do what using a database does with YAML. That’s a recipe for disaster.
Using symlinks is not a supported setup. Not because it’s impossible or even hard to do but because it means you have severe flaws in your storage concept. If you need to have YAML files synced you’re doing it wrong.

Now I’m giving you the benefit of the doubt. While I do think that the setup you’re attempting to use is fundamentally flawed I want to give you the opportunity to explain what you are trying to do and why you think that syncing YAML files between servers is the best way to go about things instead of just using a database.