gridcoin-community / Gridcoin-Research

Gridcoin-Research
MIT License
585 stars 173 forks source link

gridcoinresearch.conf corrupts on hard reset #65

Closed Kati3e closed 7 years ago

Kati3e commented 8 years ago

Seems more and more people are running into this issue. On a hard reset of the host; blue screens, cutting power, etc, the gridcoinresearch.conf file corrupts with empty contents or random characters.

A upload of one user's config file showed one long line of "NUL" values.

This causes the wallet to no longer open and instead spit out a C++ Runtime error.

I don't have details on that error, but I'm pretty sure it can be replicated easily by just filling your config file with spaces.

After deleting the config file or replacing it with the right syntax the wallet will start normally.

The error: (by Schietschijf on IRC)

untitled

Dikay900 commented 8 years ago

+1 had to reset my conf after shutting down my pc while gridcoin was still running

rtennill commented 8 years ago

I have experienced this a fair bit too. I keep a copy handy just in case the wallet crashes for whatever reason.

This behavior suggests that the file is not being closed after the config parameters are retrieved.

gridcoin commented 8 years ago

Checking the c++ portion, the ifstream destructor guarantees a close of the file, and according to the boost message boards its not good practice for us to add a manual close after we read the file in, so Im making the assumption this may be due to our vb.net additional feature for tickers or the neural network primary cpid row being written and not flushed.

I added code to our .net function to ensure the file is closed after it adds any key. Lets see if that fixes the problem. Will be in the next release.

gridcoin commented 8 years ago

Please let us know if this appears to have fixed it, and we can close it in 45 days. Thanks.