warjort Posted July 7, 2022 Posted July 7, 2022 It seems to be a common problem that when somebody loses power to their computer that some of the config files get corrupted. e.g. the most recent https://forums.minecraftforge.net/topic/113418-modded-world-not-loading-version-1165/ My question is why aren't the config files forced synched to disk? They are just closed. Using a Closeable here: https://github.com/TheElectronWill/night-config/blob/1d678751747451e3a8458cf12d0ced21b84ebcad/core/src/main/java/com/electronwill/nightconfig/core/io/ConfigWriter.java#L87 It is my understanding that this will just leave the data in the buffer cache, and doesn't guarantee it will be physically on disk. I could be wrong about that and it might depend on the OS? Minecraft uses the following logic where file is a FileChannel - see net.minecraft.world.level.chunk.storage.RegionFile try { this.file.force(true); } finally { this.file.close(); } Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
warjort Posted July 7, 2022 Author Posted July 7, 2022 Yes, that is what I thought. You can Channel.force() or FileDescriptor.sync() to ensure the data is written to disk. Why isn't this done for config files to avoid corruption if you have things like power outages? Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
warjort Posted July 7, 2022 Author Posted July 7, 2022 I am not saying it is a silver bullet, but it does decrease the time the config files are held in the buffer rather than on disk, making it less likely to happen. People with large amounts of free memory can have large buffer caches that are not flushed for a while. Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
warjort Posted July 7, 2022 Author Posted July 7, 2022 I create this issue: https://github.com/TheElectronWill/night-config/issues/111 Quote Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.