OpenComputers icon indicating copy to clipboard operation
OpenComputers copied to clipboard

Add config option to disable chunk loading/whitelist not working

Open kmecpp opened this issue 5 years ago • 2 comments

Its very important for large servers to be able to disable any sort of chunk loading.

I tried doing this by adding a non-existent world to the chunkloading whitelist (so that everything else would be disabled) but it gets erased when i restart the server.

Could a separate config option please be added to completely disable all chunk loading or can you fix the mod removing a world from the whitelist if it doesn't exist at startup?

kmecpp avatar Mar 16 '19 18:03 kmecpp

you're saying the config changes you make are thrown away? I recall a similar bug like this a long time ago. At the momeny I don't recall what the resolution was. What version (full oc filename please) are you running?

payonel avatar Mar 17 '19 00:03 payonel

Yes but the world didn't exist so I thought maybe that was why. I'm running OpenComputers-MC1.7.10-1.7.4.1265

kmecpp avatar Mar 17 '19 14:03 kmecpp

Nothing in the code actually validates the dimension ID existing... I'm more worried about the "config changes thrown away" thing. Can this be reproduced on OC 1.7.6?

asiekierka avatar Sep 03 '22 14:09 asiekierka

Nothing in the code actually validates the dimension ID existing... I'm more worried about the "config changes thrown away" thing. Can this be reproduced on OC 1.7.6?

Yes it is still a problem on v1.7.6. Easily replicated exactly as I explained. Enter a random world that doesn't exist in dimWhitelist and the config gets reset on startup.

Agreed that config changes getting thrown away is indeed a huge problem. I tried to make a creative server but it was destroyed because my config with debugCardAccess=deny got reset to debugCardAccess=allow when I changed the dim whitelist.

Despite this, my suggestion to disable debug cards by default was ignored

kmecpp avatar Sep 05 '22 16:09 kmecpp

I've just performed the following steps:

  1. Downloaded OpenComputers 1.7.6. (Minecraft 1.7.10)
  2. Set up a new instance with just OpenComputers 1.7.6 and Forge 1614.
  3. Turned on the game.
  4. Turned off the game.
  5. Edited the config to add four non-existent dimension IDs (1000, 2000, 3000, 4000) to chunkloader.dimWhitelist as well as set debugCardAccess to deny.
  6. Turned on the game.
  7. Turned off the game.
  8. Checked the config.

Both config changes are present. In fact, the formatting on the dimension IDs has been adjusted, which is how I can tell that the game engine successfully read and wrote the file.

There must be something else going on.

asiekierka avatar Sep 05 '22 19:09 asiekierka

Oh I didn't even realize it was dimension IDs only. Try using a non-integer for the dimension.

kmecpp avatar Sep 05 '22 19:09 kmecpp

Well, yes, that would cause a parsing error:

[21:48:42] [Client thread/WARN] [OpenComputers]: Failed loading config, using defaults.
com.typesafe.config.ConfigException$WrongType: String: 21: chunkloader.dimWhitelist has type list of STRING rather than list of NUMBER

and the game then informs you the config file is reverted to defaults - because it failed to load correctly.

I agree that the requirement of it being dimension IDs is not documented clearly, and this will be fixed in OC 1.8.0.

asiekierka avatar Sep 05 '22 19:09 asiekierka

Don't think a parsing error loading the config should cause it to reset.

Is it possible to log the error, skip that setting and continue loading the config? And also not save the config if an error occurred while loading it?

Also from your message it looks like the resulting error message is logged as a warning and is only two lines which seems very easy to miss for something as severe as your config getting reset.

kmecpp avatar Sep 06 '22 13:09 kmecpp

"Is it possible to log the error, skip that setting and continue loading the config?" - No. This is a limitation of the config parsing library OpenComputers uses; "And also not save the config if an error occurred while loading it?" - Yes, but it might be a better option to simply crash the game if the config is incorrect. If the user wants to reset to defaults, they can just delete the configuration file.

As for the "two lines" remark - I omitted the full stacktrace for brevity - this is how it appears in the log:

[18:08:20] [Client thread/WARN]: Failed loading config, using defaults.
com.typesafe.config.ConfigException$WrongType: String: 20: chunkloader.dimWhitelist has type list of STRING rather than list of NUMBER
	at com.typesafe.config.impl.SimpleConfig.getHomogeneousWrappedList(SimpleConfig.java:344) ~[SimpleConfig.class:?]
	at com.typesafe.config.impl.SimpleConfig.getIntList(SimpleConfig.java:300) ~[SimpleConfig.class:?]
	at li.cil.oc.Settings$.getIntList(Settings.scala:725) ~[Settings$.class:?]
	at li.cil.oc.Settings.<init>(Settings.scala:413) ~[Settings.class:?]
	at li.cil.oc.Settings$.load(Settings.scala:515) [Settings$.class:?]
	at li.cil.oc.common.Proxy.preInit(Proxy.scala:32) [Proxy.class:?]
	at li.cil.oc.client.Proxy.preInit(Proxy.scala:37) [Proxy.class:?]
	at li.cil.oc.OpenComputers$.preInit(OpenComputers.scala:40) [OpenComputers$.class:?]
	at li.cil.oc.OpenComputers.preInit(OpenComputers.scala) [OpenComputers.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_345]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_345]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_345]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_345]
	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532) [FMLModContainer.class:?]
	at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_345]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_345]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212) [LoadController.class:?]
	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190) [LoadController.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_345]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_345]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_345]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_345]
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) [guava-17.0.jar:?]
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) [guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) [guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) [guava-17.0.jar:?]
	at com.google.common.eventbus.EventBus.post(EventBus.java:275) [guava-17.0.jar:?]
	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119) [LoadController.class:?]
	at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556) [Loader.class:?]
	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243) [FMLClientHandler.class:?]
	at net.minecraft.client.Minecraft.startGame(Minecraft.java:480) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:878) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_345]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_345]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_345]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_345]
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source) [start/:?]
	at GradleStart.main(Unknown Source) [start/:?]```

asiekierka avatar Sep 06 '22 16:09 asiekierka

Ah weird, still missed that error somehow.

Crashing the game sounds better than resetting the config

kmecpp avatar Sep 06 '22 16:09 kmecpp

The other thing you can do, of course, is remove the recipe for the Chunkloader Upgrade, which is the only thing in OpenComputers capable of chunkloading.

asiekierka avatar Sep 06 '22 17:09 asiekierka