-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Corrupted config file #152
Comments
Corrupted in what way? Empty file? Invalid JSON? |
From past experience, issues like these are often connected to anti-virus software. |
It's hard to tell how it was corrupted as the file was encrypted and even losing one byte will result in a completely meaningless file. There is an error in the json decode because the content does not start with a standard json (not with a In which way antivirus is messing up with our files? is there a way we can go around this? |
Would it make sense to backup the file at the end of each write, so either the default file or the backup should be fine? (maybe 1 save behind, but at least not corrupted?) |
It's hard to say what the correct fix would be without being able to reliably reproduce the issue. |
You could try to replace this call: Line 466 in 57bd2a2
with: fs.writeFileSync(this.path, data); To see if the problem is with the atomic writing. |
We have been using conf with an electron* for a while with encryption enabled.
Somehow it's happening to something like 1 out of 100-300 users that the config.json file gets corrupted. We are noticing this happening more to Windows users with also Avast antivirus installed (maybe it's messing with the read/write, or maybe is just a coincidence)
The error we are getting is
That is the classical error when JSON.parse fails.
Notes:
Did this ever happen to anybody?
Is there a way to prevent it?
Is it possible that if the app is killed/quitted while writing then the file is messed up? (I see that
atomically
is being used, so this shouldn't the case).The text was updated successfully, but these errors were encountered: