Carpet

Carpet

2M Downloads

Function `store_app_data()` broken in 1.17

julienvincent opened this issue ยท 7 comments

commented

Hi there,

I updated my MC server to 1.17 yesterday and have not been able to run our cam.sc (called c.sc on our server) script since.

When attempting to run, it fails with

Unhandled io_exception exception: Unable to write tag to ./world/./scripts/c.data.nbt in c at line 120, pos 4]

Which is the line store_app_data(apptag);. I have also tried to play with it a bit and tested with the write_file function and had the same issue. The path in the error message looks malformed and the fact that I get the same issue for both functions makes me think there is some underlying issue in carpet.

Any assistance would be greatly appreciated :)

commented

The unable to write to... is just a generic error message Carpet throws when some error occurs in the process. Path looks good to me (. means "current directory", so should be practically ignored being in the middle, the first one is basically relative to server jar).

Something may have changed in the vanilla code that is used for saving nbt, will check it in a bit once I fix my dev environment, it isn't currently launching for 1.17.

commented

Hm... So I've tested it, and it works for me in dev... Not sure what's going wrong for you. Details about your system would probably be useful, since when dealing with filesystems, many things change between each other.

Wait, actually I didn't test it in a server, but singleplayer. Testing it rn. Still cannot reproduce.

commented

Path looks good to me ...

Right, yea you are correct the path should be interpreted correctly.

Details about your system would probably be useful

This is running in a docker container (https://github.com/itzg/docker-minecraft-server specifically) which is based off of ubuntu 20 and running Java 16:

root@139b434119f9:/data# cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

Perhaps you will have better luck reproducing if you can run the above container. I originally suspected file permissions but AFAIKS the server has full rw access.

Any other info I can provide to help debug?

commented

I can't run a docker container rn, could you try to run the build from this action (artifacts, the one with less prefixes) and share the log if the error occurs? (there is only a very small possibility of it being fixed, but may be. The log from it should have additional information though).

Edit: Completely forgot you are in 1.17. This one (artifacts, the one with less prefixes) is a 1.17 build with the above change.

Source diff here btw

commented

@altrisi Thanks, that build revealed the underlying issue:

java.nio.file.AccessDeniedException: ./world/./scripts/c.data.nbt_tmp
	at sun.nio.fs.UnixException.translateToIOException(Unknown Source) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) ~[?:?]
	at sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) ~[?:?]
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(Unknown Source) ~[?:?]
	at java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source) ~[?:?]
	at java.nio.file.Files.newOutputStream(Unknown Source) ~[?:?]
	at carpet.script.argument.FileArgument.writeTagDisk(FileArgument.java:424) ~[fabric-carpet.jar:?]
	at carpet.script.bundled.Module.saveData(Module.java:30) ~[fabric-carpet.jar:?]
	at carpet.script.CarpetScriptHost.dumpState(CarpetScriptHost.java:934) ~[fabric-carpet.jar:?]
	at carpet.script.CarpetScriptHost.writeTagFile(CarpetScriptHost.java:965) ~[fabric-carpet.jar:?]
	at carpet.script.api.Auxiliary.lambda$apply$50(Auxiliary.java:966) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$16.lazyEval(Expression.java:566) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1292) ~[fabric-carpet.jar:?]
	at carpet.script.language.ControlFlow.lambda$apply$5(ControlFlow.java:33) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$15.lazyEval(Expression.java:536) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1292) ~[fabric-carpet.jar:?]
	at carpet.script.value.FunctionValue.execute(FunctionValue.java:255) ~[fabric-carpet.jar:?]
	at carpet.script.value.FunctionValue.callInContext(FunctionValue.java:157) ~[fabric-carpet.jar:?]
	at carpet.script.language.Functions$1.lazyEval(Functions.java:54) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1292) ~[fabric-carpet.jar:?]
	at carpet.script.language.ControlFlow.lambda$apply$2(ControlFlow.java:26) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$5.lazyEval(Expression.java:328) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$16(Expression.java:1284) ~[fabric-carpet.jar:?]
	at carpet.script.language.ControlFlow.lambda$apply$9(ControlFlow.java:56) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$14.lazyEval(Expression.java:500) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1292) ~[fabric-carpet.jar:?]
	at carpet.script.language.ControlFlow.lambda$apply$2(ControlFlow.java:27) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$5.lazyEval(Expression.java:328) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$16(Expression.java:1284) ~[fabric-carpet.jar:?]
	at carpet.script.language.ControlFlow.lambda$apply$9(ControlFlow.java:50) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$14.lazyEval(Expression.java:500) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1292) ~[fabric-carpet.jar:?]
	at carpet.script.language.ControlFlow.lambda$apply$5(ControlFlow.java:33) ~[fabric-carpet.jar:?]
	at carpet.script.Expression$15.lazyEval(Expression.java:536) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.lambda$extractOp$19(Expression.java:1292) ~[fabric-carpet.jar:?]
	at carpet.script.value.FunctionValue.execute(FunctionValue.java:255) ~[fabric-carpet.jar:?]
	at carpet.script.value.FunctionValue.lazyEval(FunctionValue.java:209) ~[fabric-carpet.jar:?]
	at carpet.script.CarpetScriptHost.lambda$callLegacy$25(CarpetScriptHost.java:819) ~[fabric-carpet.jar:?]
	at carpet.script.Expression.evalValue(Expression.java:906) ~[fabric-carpet.jar:?]
	at carpet.script.CarpetScriptHost.callLegacy(CarpetScriptHost.java:818) ~[fabric-carpet.jar:?]
	at carpet.script.CarpetScriptHost.handleCommandLegacy(CarpetScriptHost.java:694) ~[fabric-carpet.jar:?]
	at carpet.script.CarpetScriptHost.lambda$addLegacyCommand$14(CarpetScriptHost.java:515) ~[fabric-carpet.jar:?]
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:263) ~[intermediary-server.jar:?]
	at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:177) ~[intermediary-server.jar:?]
	at net.minecraft.class_2170.method_9249(class_2170.java:251) ~[intermediary-server.jar:?]
	at net.minecraft.class_3244.method_14370(class_3244.java:1239) ~[intermediary-server.jar:?]
	at net.minecraft.class_3244.method_31286(class_3244.java:1223) ~[intermediary-server.jar:?]
	at net.minecraft.class_3244.method_12048(class_3244.java:1206) ~[intermediary-server.jar:?]
	at net.minecraft.class_2797.method_12115(class_2797.java:30) ~[intermediary-server.jar:?]
	at net.minecraft.class_2797.method_11054(class_2797.java:7) ~[intermediary-server.jar:?]
	at net.minecraft.class_2600.method_11072(class_2600.java:21) ~[intermediary-server.jar:?]
	at net.minecraft.class_3738.run(class_3738.java:18) ~[intermediary-server.jar:?]
	at net.minecraft.class_1255.method_18859(class_1255.java:151) ~[intermediary-server.jar:?]
	at net.minecraft.class_4093.method_18859(class_4093.java:23) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_24306(MinecraftServer.java:783) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_18859(MinecraftServer.java:167) ~[intermediary-server.jar:?]
	at net.minecraft.class_1255.method_16075(class_1255.java:125) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_20415(MinecraftServer.java:765) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_16075(MinecraftServer.java:759) ~[intermediary-server.jar:?]
	at net.minecraft.class_1255.method_5383(class_1255.java:110) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_16208(MinecraftServer.java:743) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.handler$zfh000$modifiedRunLoop(MinecraftServer.java:2902) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:671) ~[intermediary-server.jar:?]
	at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:274) ~[intermediary-server.jar:?]
	at java.lang.Thread.run(Unknown Source) [?:?]

So I guess it is file permissions? But that doesn't really make sense as the server has access to read/write the world data

commented

Ok, in light of this I played around a bit with the uid:gid of the container and running it as root (0:0) resolved the issue. Still not sure what exactly changed to make this necessary - but it might be due to an update to the docker image I am using and not fabric itself.

I guess this can be closed, thanks for your help! The dev build helped confirm that it was file permissions :)

commented

docker default running as root-nonroot situation messed up lots of things, not just for minecraft, but in general deployments as well.