GoXLR-on-Linux / goxlr-utility

An unofficial GoXLR App replacement for Linux, Windows and MacOS
MIT License
670 stars 37 forks source link

After a power outage GoXlr Utility no longer launches #122

Closed bobbarebygg closed 1 year ago

bobbarebygg commented 1 year ago

I'm not 100% sure if it had anything to do with the abrupt power loss or the fact that I always put my computer to sleep and not shutdown (it was in sleep mode when it lost power)

It is still working in the offical software. Please let me know what else information you need me to share.

FrostyCoolSlug commented 1 year ago

Can you move the file %APPDATA%/goxlr-on-linux/goxlr-utility/config/settings.json out the way and try launching again? It's possible the file was corrupted by the power outage, if that works, can you drop the broken file here and I'll take a look?

If that ends up being the problem, I'll try and make the file more resilient

Thanks.

bobbarebygg commented 1 year ago

Can you move the file %APPDATA%/goxlr-on-linux/goxlr-utility/config/settings.json out the way and try launching again? It's possible the file was corrupted by the power outage, if that works, can you drop the broken file here and I'll take a look?

If that ends up being the problem, I'll try and make the file more resilient

Thanks.

That Worked! Thanks 👍

FrostyCoolSlug commented 1 year ago

Thanks, it's a bizarre bug, I can't see a reason why the util would be accessing that file when windows goes to sleep, bit what I'm going to do is write the settings out to a temporary file, then copy it across once it's written and verified. Should catch these kinds of cases and prevent issues from occurring if the util goes out in the middle of a write.

bobbarebygg commented 1 year ago

can you drop the broken file here and I'll take a look?

Sorry missed that part, Github doesn't allow me to send .json files unfortunately. If I open the file in notepad++ there's only a bunch of "Nul" over and over again. Tell me if you want me to send the file some other way

FrostyCoolSlug commented 1 year ago

You can probably rename the file to .txt and it should be handled fine here, but the report seems to match behaviours that others have reported in other places.

Since this report came in I've rewritten all the file 'Save' features of the utility to use an intermediate temp file to put everything together before replacing the original file. From what I can tell, all issues similar to this which have been reported all have the same behaviour, the disk space is allocated (and filled with nulls), but there's some kind of interruption happening which is preventing the utility from filling the contents.

These interruptions may be something as simple as a write operation being called just as windows is going to sleep (leaving it incomplete), and the power failure preventing the write from completing on wake, or windows simply agressively killing the utility process when 'Save' is part of the shutdown behaviours. Based on the behaviours, it may also be a situtaion where the file has been written to disk but windows hasn't fully flushed it's contents. There were also possible (although rare) cases where if the utility wasn't able to serialise a profile to XML, or the settings to json it would destroy the profile / settings during write.

I'm hoping for now that if something goes wrong during the write (for whatever reason), the worst that can happen is that the settings / profile aren't saved, rather than them being lost.

I've also added a change where if the settings file is found to be corrupt, rather than aborting the utility at startup (the behaviour you were seeing), it'll simply move the old file out the way and create a new file using defaults. At least in that scenario you can re-load profiles and settings, rather than having to dig through the utils files manually to solve it.

Thanks!

bobbarebygg commented 1 year ago

Here's the file in case you wanna view it settings.txt Thanks for all the good work you're doing :)