Page 1 of 1

Write to a temp file 1st.

Posted: Tue Jun 30, 2020 12:13 am
by BryanFRitt
BryanFRitt wrote: Tue Jun 30, 2020 12:10 am Several times during playing there were these crashes where it lost old save data, old high scores, and/or list of completed levels. Instead of writing directly to [existing] files RnD should finish a temp file and then rename that. This would minimize the likelihood of data loss if something were to happen during writing. (If RnD already does so, I never found out about it during my playing)
viewtopic.php?f=7&t=3086

Re: Write to a temp file 1st.

Posted: Tue Jun 30, 2020 11:02 pm
by Holger
If you encounter lots of crashes that may be caused by bad memory (see other thread), trying to fix your system seems to be better than trying to work around the resulting data loss. :?

Re: Write to a temp file 1st.

Posted: Wed Jul 01, 2020 9:41 pm
by BryanFRitt
An analogy would be wearing helmet and elbow/knee pads when doing a stunt. Sure it doesn't reduce the chances of an accident happening, but it would likely reduce the damage done if an accident occurs.

complete temp file creation in temp folder / copy temp file / rename(overwriting old file, if need be) / delete temp file(s)
"TL;DR - it mostly boils down to atomicity, that is, you want to make it so that (at the final location) the file is either complete or not there at all at any given time."
source: https://softwareengineering.stackexchan ... -to-the-in

Re: Write to a temp file 1st.

Posted: Wed Jul 01, 2020 9:56 pm
by BryanFRitt
Holger wrote: Tue Jun 30, 2020 11:02 pm If you encounter lots of crashes that may be caused by bad memory (see other thread), trying to fix your system seems to be better than trying to work around the resulting data loss. :?
I'm only getting these crashes with R'n'D. I've run the built-in to laptop memory tests, and it passes. Maybe it could be a driver issue? and/or maybe race condition? Most(but not all) of the time it crashes seems to be when quickly saving/restoring games several times.

Re: Write to a temp file 1st.

Posted: Wed Jul 01, 2020 10:50 pm
by Holger
I'm only getting these crashes with R'n'D.
Hm, OK... then it was misunderstanding. From reading the other thread (as linked to above), I had the impression that R'n'D was not the only program you encountered such crashes with, but that you get similar crashes with other programs. :?

What puzzles me is the sheer number of crashes you documented in the other thread, which I neither encountered by myself (no crashes for a very long time), nor were reported by others.
Most(but not all) of the time it crashes seems to be when quickly saving/restoring games several times.
It may indeed be possible that different usage of the game triggers bugs that are hidden under "normal" circumstances.

Could you please do some more test runs with your usual "R'n'D usage profile" on a different computer? Just to see if you get those crashes on a different system, too, or if this only happens on a single machine.