Closed SquidDev closed 1 year ago
Does this open Forge PR look like it would fix your issue? https://github.com/MinecraftForge/MinecraftForge/pull/9016
That definitely looks like the same bug, yep! I think applying the patch from ConfigTracker
would be "good enough" (so swapping save
and unload
), at least for my needs.
I did that in the latest version, hope all works fine now.
Sorry, only just got round to updating. This appears to work perfectly, thank you!
Mod Loader (Required)
Fabric
Minecraft Version (Required)
1.19.3
Mod Version (Required)
4.2.6
Notes (Required)
When unloading a world, it's possible for the config file watcher to observe a file update at the same time as the config is cleared. This can cause a race condition where
ForgeConfigSpec.isLoaded()
returns true at the start of the method, but disappears out under you while reading config values!I'm afraid I've not spent much time debugging this: my guess is that the config object being saved before unloading is triggering the file watcher. However, I've not observed the behaviour on Forge, so it's very odd!
Reproduction case
Consider the following class body, where
onReload
is subscribed to a mod's config reload bus.When exiting a world, one may (it's not deterministic, maybe 1 in 5 times) see the following output:
You can see that the config is reloaded on two separate threads, in such a way that
ForgeConfigSpec.isLoaded
changes fromtrue
tofalse
during our method execution!latest.log (Optional)
No response