Write to a temp file 1st.

Found a bug in R'n'D? Report it here!

Moderators: Zomis, Flumminator

Post Reply
BryanFRitt
Posts: 77
Joined: Mon Nov 13, 2017 4:16 pm

Write to a temp file 1st.

Post by BryanFRitt » Tue Jun 30, 2020 12:13 am

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

User avatar
Holger
Site Admin
Posts: 3268
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Write to a temp file 1st.

Post by Holger » 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. :?

BryanFRitt
Posts: 77
Joined: Mon Nov 13, 2017 4:16 pm

Re: Write to a temp file 1st.

Post by BryanFRitt » Wed Jul 01, 2020 9:41 pm

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

BryanFRitt
Posts: 77
Joined: Mon Nov 13, 2017 4:16 pm

Re: Write to a temp file 1st.

Post by BryanFRitt » Wed Jul 01, 2020 9:56 pm

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.

User avatar
Holger
Site Admin
Posts: 3268
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Write to a temp file 1st.

Post by Holger » Wed Jul 01, 2020 10:50 pm

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.

Post Reply