Tweakeroo resets all its config settings if the game is force shut down
James103 opened this issue ยท 1 comments
As of Tweakeroo version 0.10.0-dev.20210710.155746 for Minecraft 1.17.1, if you force shut down the game, there is a small chance (increases if the game is crashing or spends a long time "Saving world") that all of your Tweakeroo settings get reset.
Possible steps to reproduce:
- Start up the game.
- Open a new world or join a world.
- (Recommended) Create a lot of client-side lag.
- Force shut down the game with Task Manager.
- Restart the game.
- An error will print to the log saying that Tweakeroo was unable to read the config file.
- Therefore, all Tweakeroo settings get reset to default.
This may be because Tweakeroo writes its config file in 32 KiB blocks (32,767 bytes at a time). If the file is only half written (i.e. the first chunk is written but not the second), that most likely creates JSON errors which make the file unparsable.
Try if this still happens with malilib dev.25
which I just uploaded to CF now. It changes the JSON writing to happen to a temporary file first, which then gets renamed over the old config file.
In future versions malilib will also start making rotating config backups before writing to the files (this was already implemented a few months back in the main development code).