Skip to content

java.nio.file.AtomicMoveNotSupportedException during world storage migration not handled #14059

Description

@Magicrafter13

Stack trace

I've been working on containerizing paper, and it's going fine enough, but I found some unfortunate behavior in world storage migration between versions. This may be an upstream bug, and if it is, then consider this report a feature request to reimplement/extend the current logic.

As is often the case with containers, I am working with host file systems being mounted into the container's file system (volumes). Since container images are immutable, if you allow the Minecraft world to be created inside the container's file system, you would lose the world as soon as it shuts down.

During one of my tests I spun up a 26.2 paper image (build 47 or so? latest stable), and reused a world that I created in a 1.20.4 paper image. This triggered the automatic storage migration process.

Unfortunately, it appears paper (vanilla Minecraft?) tries to create a new directory and rename the old one or some such operation that assumes <server_cwd>/world and <server_cwd> are on the same file system. It looks like paper tries to create <server_cwd>/world upgraded and then do some operation between <server_cwd>/world and <server_cwd>/world upgraded that requires them to both be the same file system.

This bug therefore impacts more than just niche usecases like mine, this would impact any server operator that, perhaps, stores worlds on different partitions or logical volumes, etc.

Here's a sample of the console output, though I don't know how helpful it is outside of class names since the bug isn't obscure or hard to trigger. Make a world in an old version, reuse it in a new version, should be all that you have to do to reproduce, so long as the world folder is a different device/filesystem.

WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by org.joml.MemUtil$MemUtilUnsafe (file:/server/librari
WARNING: Please consider reporting this to the maintainers of class org.joml.MemUtil$MemUtilUnsafe
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
[23:50:56 INFO]: Environment: Environment[sessionHost=https://sessionserver.mojang.com, servicesHost=https://api.mi
[23:50:57 WARN]: [WorldFolderMigration] ===================== ! ALERT ! =====================
[23:50:57 WARN]: [WorldFolderMigration] World storage migration is required during startup.
[23:50:57 WARN]: [WorldFolderMigration] If you do not have a backup: interrupt the server now. Use Ctrl+C, your pan
[23:50:57 WARN]: [WorldFolderMigration] =====================================================
[23:50:57 WARN]: [WorldFolderMigration] Continuing in 30 seconds...
[23:51:27 INFO]: [WorldFolderMigration] Continuing with startup world migration.
[23:51:27 INFO]: Starting upgrade for world "world"
[23:51:27 INFO]: Upgrading progress: 2%
[23:51:27 INFO]: File system capabilities: FileSystemCapabilities[atomicMove=true, hardLinks=true]
[23:51:27 INFO]: Applying file structure changes for world "world"
[23:51:27 INFO]: Moving new hardlinked world to top level
[23:51:27 ERROR]: Encountered error trying to move world folder:
java.nio.file.AtomicMoveNotSupportedException: ./world/filefix/new_world -> ./world upgraded: Invalid cross-device
        at java.base/sun.nio.fs.UnixFileSystem.move(UnixFileSystem.java:821) ~[?:?]
        at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:289) ~[?:?]
        at java.base/java.nio.file.Files.move(Files.java:1319) ~[?:?]
        at net.minecraft.util.filefix.FileFixerUpper.swapInFixedWorld(FileFixerUpper.java:298) ~[paper-26.1.2.jar:2
        at net.minecraft.util.filefix.FileFixerUpper.fix(FileFixerUpper.java:99) ~[paper-26.1.2.jar:26.1.2-74-e4e17
        at net.minecraft.util.filefix.FileFixerUpper.fix(FileFixerUpper.java:76) ~[paper-26.1.2.jar:26.1.2-74-e4e17
        at net.minecraft.server.Main.main(Main.java:206) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at io.papermc.paper.PaperBootstrap.boot(PaperBootstrap.java:21) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at org.bukkit.craftbukkit.Main.main(Main.java:204) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?]
[23:51:27 ERROR]: Failed to start the minecraft server
net.minecraft.util.filefix.AbortedFileFixException: java.nio.file.AtomicMoveNotSupportedException: ./world/filefix/new_world -> ./world upgraded: Invalid cross-device link
        at net.minecraft.util.filefix.FileFixerUpper.swapInFixedWorld(FileFixerUpper.java:301) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at net.minecraft.util.filefix.FileFixerUpper.fix(FileFixerUpper.java:99) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at net.minecraft.util.filefix.FileFixerUpper.fix(FileFixerUpper.java:76) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at net.minecraft.server.Main.main(Main.java:206) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at io.papermc.paper.PaperBootstrap.boot(PaperBootstrap.java:21) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at org.bukkit.craftbukkit.Main.main(Main.java:204) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        at io.papermc.paperclip.Paperclip.lambda$main$0(Paperclip.java:42) ~[?:?]
        at java.base/java.lang.Thread.run(Thread.java:1474) ~[?:?]
Caused by: java.nio.file.AtomicMoveNotSupportedException: ./world/filefix/new_world -> ./world upgraded: Invalid cross-device link
        at java.base/sun.nio.fs.UnixFileSystem.move(UnixFileSystem.java:821) ~[?:?]
        at java.base/sun.nio.fs.UnixFileSystemProvider.move(UnixFileSystemProvider.java:289) ~[?:?]
        at java.base/java.nio.file.Files.move(Files.java:1319) ~[?:?]
        at net.minecraft.util.filefix.FileFixerUpper.swapInFixedWorld(FileFixerUpper.java:298) ~[paper-26.1.2.jar:26.1.2-74-e4e17fc]
        ... 7 more

Plugin and Datapack List

BlockPortals (1.0.9), LuckPerms (5.5.53), SimplePortals (1.7.7)

These were loaded at the time however this should not be relevant to this issue.

Actions to reproduce (if known)

Perhaps the upgrade process is different depending on how far back you go, so to have the same experience as me;

  • create a world with a Minecraft 1.20.4 version of paper
  • then use that world with a Minecraft 26.2 version of paper, ensuring that the world* directories are on a different file system (either another partition, a container bind, or a symlink - however a symlink will produce a different crash).

Paper version

  • 26.1.2-74-ver/26.1.2@e4e17fc
  • git-Paper-499 (MC: 1.20.4) (API 1.20.4-R0.1-SNAPSHOT) (Git: 9de3f75 on ver/1.20.4)

Other

I know this might seem silly to some, but there are very legitimate reasons to have worlds on their on file system.

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions