SpongePowered / Sponge

The SpongeAPI implementation targeting vanilla Minecraft and 3rd party platforms.
MIT License
383 stars 211 forks source link

Server cannot launch when SpongeForge installed #3637

Closed Eric-liucn closed 2 years ago

Eric-liucn commented 2 years ago

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

[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Create Stuff Additions v1.1.6
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Just Enough Items v7.7.1.145
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Mekanism v10.1.1
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Neat v1.7-27
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     ConnectedTexturesMod vMC1.16.1-1.1.2.6
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Citadel v1.8.1
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     SpongeAPI v8.0.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     CraftEco v1.1
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Ice and Fire v2.1.9-1.16.5
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Mekanism: Generators v10.1.1
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     LuckPerms v5.4.4
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Forge v36.2.28
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     The Twilight Forest vNONE
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Refined Storage v1.9.17
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Iron Chests v1.16.5-11.2.21
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Minecraft v1.16.5
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     CoFH Core v1.4.2.9
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Thermal Foundation v1.4.3.10
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Thermal Series v1.4.3.10
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Industrial Foregoing v3.2.14.6
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Tinkers' Construct v3.3.3.332
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Sponge v8.0.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     The One Probe v1.16-3.1.4
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Thermal Innovation v1.4.1.3
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Titanium v3.2.8.7
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Immersive Engineering v1.16.5-5.0.7-143
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Psi v1.16-96
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     CubeEngine - Teleport v1.1.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Mekanism: Additions v10.1.1
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     CubeEngine - Travel v1.1.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Botania v1.16.5-420.2
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     SpongeForge v1.16.5-36.2.5-8.0.0-RC1077
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Curios API v1.16.5-4.0.8.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Flywheel v1.16-0.2.5
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Create vv0.3.2g
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Patchouli v1.16.4-53.2
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Mantle v1.6.157
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Xaero's Minimap v22.1.2
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Thermal Cultivation v1.4.1.3
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     AutoRegLib v1.6-49
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Storage Drawers v8.5.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Thermal Expansion v1.4.2.4
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Structurize v1.16.5-1.0.343-RELEASE
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     CubeEngine - LibCube v2.0.1-SNAPSHOT
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Thermal Locomotion v1.4.1.2
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Mekanism: Tools v10.1.1
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     MineColonies v1.16.5-1.0.429-RELEASE
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     AppleSkin v2.3.0+mc1.16.4
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     MrCrayfish's Furniture Mod v7.0.0-pre22
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     ExtraBotany v1.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     NBTEdit v0.9.0
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Aquaculture 2 v1.16.5-2.1.21
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     CodeChicken Lib v4.0.6.443
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Brandon's Core v3.0.11.238
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Draconic Evolution v3.0.19.432
[13:49:56] [Server thread/INFO] [minecraft/DedicatedServer]:     Chisels & bits v1.0.63

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

gabizou commented 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?

Faithcaio commented 2 years ago

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?

gabizou commented 2 years ago

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.

dualspiral commented 2 years ago

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.

dualspiral commented 2 years ago

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).