Closed Eric-liucn closed 2 years ago
There's a lot of plugins and mods installed here. Can you narrow down to the couple few (it sounds like it's at most 2 things that are conflicting with each other) to reproduce the issue? It also looks like there's some data pack that is executing a function before the server starts, do you know anything about that?
Looks like its a bit my fault.
This function uses the "tp" command which I overwrite in my cubeengine-teleport. https://github.com/TeamTwilight/twilightforest/blob/1.18.x/src/main/resources/data/twilightforest/functions/setup_structure_hunt.mcfunction#L1
Thus when parsing the command it checks the requirements I registered for it (permission check). https://github.com/CubeEngine/core/blob/7bacc18ba0006c75d8feb1c16d3299e53e556f94/src/main/java/org/cubeengine/libcube/service/command/AnnotationCommandBuilder.java#L388 Which then fails in Sponge because there is no server that early yet.
This would always happen with any function in a datapack referencing a command added by a plugin that also does a permission check.
I could fix this in my plugin by checking if the server is available before calling CommandCause#hasPermission
but that feels wrong.
In Sponge we could maybe skip the check in SpongeNodePermissionCache#canUse
when the Server is not available?
@dualspiral thoughts?
In Sponge we could maybe skip the check in
SpongeNodePermissionCache#canUse
when the Server is not available?
This was my thought as well from reading the stack trace.
I'll have to look at the code to make sure we're not caching a lack of permission there... I'll try to look tomorrow.
Oh, right, this is datapack stuff - and a duplicate of https://github.com/SpongePowered/Sponge/issues/3322. I'm closing this in favour of that.
In Sponge we could maybe skip the check in SpongeNodePermissionCache#canUse when the Server is not available?
No, we shouldn't. canUse
can do more than just a permission check. We have already done something to try to alleviate some of this (https://github.com/SpongePowered/Sponge/commit/ca53cb4d43cc6e9271e3789e53aba3d4f7aedca3#), but that mostly affects standard commands.
Really, we need to think what to do with the CommandSourceStack
that is created on line 71 of net.minecraft.server.ServerFunctionLibrary
. It's likely we could just create a dummy subject that overrides the various permission checks. Right now, I also see that you're checking the SystemSubject
... that's probably not right in the context of functions.
Ideally, we should also be able to defer creating datapack commands - but that's probably longer term (if we can even do it).
Affected Product(s)
SpongeForge
Version
1.16.5-36.2.5-8.0.0-RC1077
Operating System
Windows server 2022
Java Version
open jdk 11 (Microsoft)
Plugins/Mods
Describe the bug
The server stuck during the init stage with spongeforge.
Immersive Engineering throws out an exception and then the server stop (not crash just stop loading)
This will not occur without spongeforge.
two log files, one is with spongeforge, one is not, other mods installed no change https://gist.github.com/Eric-liucn/87f0a4500ea91a6b86781a19a6ccf121
Link to logs
https://gist.github.com/Eric-liucn/87f0a4500ea91a6b86781a19a6ccf121