Simple Config

Simple Config

55.4k Downloads

Crash when stopping the neo forge server with 'Simple Config'.

BalancedCracker opened this issue ยท 3 comments

commented

Describe the bug
An exception occurred while stopping the server on the Neo Forge server with ONLY Simple Config.
I don't think it's a problem that has a negative effect on world data, but I want to eliminate the problem if possible.

Versions
minecraft server: 1.20.1
neo forge: 1.20.1-47.1.79
simple config: 1.20.1-1.0.3

To Reproduce
Steps to reproduce the behavior:

  1. Run the neo forge server using only 'Simple Config'
  2. Stop the server
  3. See error

Expected behavior
Exception caught during firing event: Cannot invoke "net.minecraft.server.MinecraftServer.m_6846_()" because the return value of "net.minecraftforge.network.PacketDistributor.getServer()" is null

Log Details
> stop
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping the server
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (world): All chunks are saved
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved
[11:16:02] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage: All dimensions are saved
[11:16:02] [Server thread/ERROR] [ne.mi.fm.ja.FMLModContainer/]: Exception caught during firing event: Cannot invoke "net.minecraft.server.MinecraftServer.m_6846_()" because the return value of "net.minecraftforge.network.PacketDistributor.getServer()" is null
	Index: 2
	Listeners:
		0: NORMAL
		1: ASM: endorh.simpleconfig.core.SimpleConfigImpl@3339acf5 onModConfigEvent(Lnet/minecraftforge/fml/event/config/ModConfigEvent;)V
		2: ASM: endorh.simpleconfig.core.SimpleConfigImpl@154f2918 onModConfigEvent(Lnet/minecraftforge/fml/event/config/ModConfigEvent;)V
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.MinecraftServer.m_6846_()" because the return value of "net.minecraftforge.network.PacketDistributor.getServer()" is null
	at TRANSFORMER/[email protected]/net.minecraftforge.network.PacketDistributor.lambda$playerListAll$3(PacketDistributor.java:210)
	at TRANSFORMER/[email protected]/net.minecraftforge.network.PacketDistributor$PacketTarget.send(PacketDistributor.java:165)
	at TRANSFORMER/[email protected]/net.minecraftforge.network.simple.SimpleChannel.send(SimpleChannel.java:107)
	at TRANSFORMER/[email protected]/endorh.simpleconfig.core.SimpleConfigNetworkHandler$SAbstractPacket.sendToAll(SimpleConfigNetworkHandler.java:474)
	at TRANSFORMER/[email protected]/endorh.simpleconfig.core.SimpleConfigImpl.syncToClients(SimpleConfigImpl.java:386)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java:111)
	at TRANSFORMER/[email protected]/endorh.simpleconfig.core.SimpleConfigImpl.onModConfigEvent(SimpleConfigImpl.java:472)
	at TRANSFORMER/[email protected]/endorh.simpleconfig.core.__SimpleConfigImpl_onModConfigEvent_ModConfigEvent.invoke(.dynamic)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:315)
	at MC-BOOTSTRAP/net.minecraftforge.eventbus/net.minecraftforge.eventbus.EventBus.post(EventBus.java:296)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.javafmlmod.FMLModContainer.lambda$new$0(FMLModContainer.java:42)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModContainer.lambda$dispatchConfigEvent$13(ModContainer.java:153)
	at java.base/java.util.Optional.ifPresent(Optional.java:178)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.ModContainer.dispatchConfigEvent(ModContainer.java:153)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.config.ModConfig.fireEvent(ModConfig.java:77)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.config.ConfigTracker.closeConfig(ConfigTracker.java:73)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.config.ConfigTracker.lambda$unloadConfigs$2(ConfigTracker.java:55)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at java.base/java.util.Collections$SynchronizedCollection.forEach(Collections.java:2351)
	at LAYER PLUGIN/[email protected]/net.minecraftforge.fml.config.ConfigTracker.unloadConfigs(ConfigTracker.java:55)
	at TRANSFORMER/[email protected]/net.minecraftforge.server.ServerLifecycleHooks.handleServerStopped(ServerLifecycleHooks.java:143)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:697)
	at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251)
	at java.base/java.lang.Thread.run(Thread.java:1583)

[11:16:02] [Server thread/ERROR] [minecraft/MinecraftServer]: Uncaught exception in server thread
java.lang.NullPointerException: Cannot invoke "net.minecraft.server.MinecraftServer.m_6846_()" because the return value of "net.minecraftforge.network.PacketDistributor.getServer()" is null
	at net.minecraftforge.network.PacketDistributor.lambda$playerListAll$3(PacketDistributor.java:210) ~[forge-1.20.1-47.1.79-universal.jar%23110!/:?] {re:classloading}
	at net.minecraftforge.network.PacketDistributor$PacketTarget.send(PacketDistributor.java:165) ~[forge-1.20.1-47.1.79-universal.jar%23110!/:?] {re:classloading}
	at net.minecraftforge.network.simple.SimpleChannel.send(SimpleChannel.java:107) ~[forge-1.20.1-47.1.79-universal.jar%23110!/:?] {re:classloading}
	at endorh.simpleconfig.core.SimpleConfigNetworkHandler$SAbstractPacket.sendToAll(SimpleConfigNetworkHandler.java:474) ~[simpleconfig-1.20.1-1.0.3.jar%23103!/:1.20.1-1.0.3] {re:classloading}
	at endorh.simpleconfig.core.SimpleConfigImpl.syncToClients(SimpleConfigImpl.java:386) ~[simpleconfig-1.20.1-1.0.3.jar%23103!/:1.20.1-1.0.3] {re:classloading,pl:eventbus:A,pl:runtimedistcleaner:A}
	at net.minecraftforge.fml.DistExecutor.unsafeRunWhenOn(DistExecutor.java:111) ~[core-47.1.47.jar%23106!/:47.1] {}
	at endorh.simpleconfig.core.SimpleConfigImpl.onModConfigEvent(SimpleConfigImpl.java:472) ~[simpleconfig-1.20.1-1.0.3.jar%23103!/:1.20.1-1.0.3] {re:classloading,pl:eventbus:A,pl:runtimedistcleaner:A}
	at endorh.simpleconfig.core.__SimpleConfigImpl_onModConfigEvent_ModConfigEvent.invoke(.dynamic) ~[simpleconfig-1.20.1-1.0.3.jar%23103!/:1.20.1-1.0.3] {re:classloading,pl:eventbus:B}
	at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2355!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2355!/:?] {}
	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2355!/:?] {}
	at net.minecraftforge.fml.javafmlmod.FMLModContainer.lambda$new$0(FMLModContainer.java:42) ~[language-java-47.1.47.jar%23107!/:47.1] {}
	at net.minecraftforge.fml.ModContainer.lambda$dispatchConfigEvent$13(ModContainer.java:153) ~[core-47.1.47.jar%23106!/:47.1] {}
	at java.util.Optional.ifPresent(Optional.java:178) ~[?:?] {}
	at net.minecraftforge.fml.ModContainer.dispatchConfigEvent(ModContainer.java:153) ~[core-47.1.47.jar%23106!/:47.1] {}
	at net.minecraftforge.fml.config.ModConfig.fireEvent(ModConfig.java:77) ~[core-47.1.47.jar%23106!/:47.1] {}
	at net.minecraftforge.fml.config.ConfigTracker.closeConfig(ConfigTracker.java:73) ~[core-47.1.47.jar%23106!/:47.1] {}
	at net.minecraftforge.fml.config.ConfigTracker.lambda$unloadConfigs$2(ConfigTracker.java:55) ~[core-47.1.47.jar%23106!/:47.1] {}
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?] {}
	at java.util.Collections$SynchronizedCollection.forEach(Collections.java:2351) ~[?:?] {}
	at net.minecraftforge.fml.config.ConfigTracker.unloadConfigs(ConfigTracker.java:55) ~[core-47.1.47.jar%23106!/:47.1] {}
	at net.minecraftforge.server.ServerLifecycleHooks.handleServerStopped(ServerLifecycleHooks.java:143) ~[forge-1.20.1-47.1.79-universal.jar%23110!/:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:697) ~[server-1.20.1-20230612.114412-srg.jar%23105!/:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23105!/:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:1583) ~[?:?] {}
> stop
^C
% 

Screenshots
(nothing)

Additional context
Add any other context about the problem here.

commented

Hi, first of all, thanks for the great report, it has all the information I could need.

As you say, it shouldn't have any adverse effect, it's just a failure while handling an event that should've probably been ignored in the first place while the server shuts down.

I'll try to fix it later today. Thanks again for the report ^^
I never tested to shut down a server normally before publishing the update ๐Ÿ˜…

commented

I've reproduced the issue. It seems it was introduced when Forge added a new ModConfigEvent.Unloading event in 1.19.4, fired as the server shuts down.
For the purposes of Simple Config it's safe to simply ignore this event, so the fix was easy.

I've already updated a new version (1.0.4) targeting both 1.19.4 and 1.20.1 on Curse Forge. However, it may take 2-3 days until the manual review process allows the files to be publicly listed.
If you want to download it earlier to test it out, you can download it from the maven package (You should be able to find a simpleconfig-1.20.1-1.0.4.jar link in the bottom of the right margin).

Please, close the issue if you have the time to verify the fix works for you.
Thanks again for the report ^^

commented

it is perfect! ๐Ÿ˜ƒ

Simple Config is my favorite, both functions and designs.
It was good to be able to help you.