[1.12] Malformed json file
Terrails opened this issue ยท 13 comments
This started happening after completing around 40-50 quests (GregBlock modpack), every time I restart my server the QuestProgress file gets malformed out of the sudden, and then I have to recover it via backup. This is really annoying since the server restarts daily and every time it does this I have to download the backup, and copy over the QuestProgress file to the server. I really can't explain what is happening here but the obvious thing when looking at the files is to the malformed json loses quite a bit of data (from 20k+ lines to 16k lines)
BQ Version: 3.5.275
Forge Version: 14.23.5.2768
Here are the json files before and after the restart, but I doubt they will be of any help since the error in the file is obvious, at the end its missing brackets and values. I've seen some other issues similar to mine, but closing the brackets in the malformed file doesn't help at all, the completed quests are still not loaded.
Also the error BQ printed in the log. One more thing to note is that QuestDatabase file gets malformed sometimes too.
This error happend now 4 times on our 2 Enigmatica2 Servers and every time the file has around 12Mb, before the file is getting malformed.
This wouldn't be an issue if every player does have it's own file and only online players are being saved.
Please stop suggesting that. I've already explained how unfeasible that idea is. In fact build 282 should have already addressed another bunch of cases where corruption could occur.
Same Exact issue also with Gregblock pack with the same forge and BQ versions. Could this have something to do with the Threaded Writing implementation 0aa9f56
Maybe attempting to test with a mod version from before that commit might help narrow down the issue.
Might be a good idea to test. I'll have to look into the threading to see if anything go messed up during implementation there.
Just tried downgrading to 3.5.270 to test (271 is the one that added Threaded Writing) and it looks like its working now. Restarting the server a couple of times didn't cause the malformed file to create.
Weird, I cannot reproduce the error on that local server, maybe because the only player on the server was me. Completed double the quests that had been completed on the server and the error didn't happen at all. The error can be reproduced if I use the world from the original server, otherwise I can't reproduce it myself.
This is my life half the time when testing these bugs. Server operators especially can reproduce things I can't in dev and it's fruatrating.
I've checked over the writing code and my current assumption is that a file read is happening while the server is writing to it on another thread and the file system cache is VERY unhappy about this. There was a recent crash report I'd never seen before that led me to this assumption
@Terrails Did you complete 40 or 50 quests to increase the size of the question db between the restarts. We noticed that it doesn't seem to corrupt all the time and we think it has to do with the amount of data stored but we don't have anything to back it up besides that after a restart that ruins the quest file completing a only a few quests doesn't cause issues when restarting again.
Pretty sure its when you complete a bunch of quests since it didn't happen at all the first day or two when only a small amount of quests were completed, but after that it happened each time. Will get back with an update when I test it, probably going to test it on a local server by just completing a couple of quests and restarting each time.
Yeah, it really sucks when that happens. As much as I appreciate that my icons are properly colored in the latest version, I guess I'll revert to the version I was using previously until this is fixed.
Hate to be the bearer of bad news but this is not a new problem, has existed prior to 0aa9f56 , this has been happening for months in my experience at the minimum since May.
Same instance as the original reporter the file will randomly corrupt on a server restart if the file has a large amount of quests or large amount of players completing quests.
I wouldn't be surprised if it is indeed a issue with threaded writing, I've been aware of #405 for some time, could the server shut down be happening too quick for the file to finish writing all player quest data to file and then corrupt with larger quest packs/playerbase?