Write to a temp file 1st.

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

Moderators: Flumminator, Zomis

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

Write to a temp file 1st.

Post 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
Life is partially trying to strike a balance between generating new things/ideas, and making sure they are good/organized. These extremes can be said to between gibberish mess and nothing said/done.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Write to a temp file 1st.

Post 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. :?
BryanFRitt
Posts: 219
Joined: Mon Nov 13, 2017 4:16 pm

Re: Write to a temp file 1st.

Post 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
Life is partially trying to strike a balance between generating new things/ideas, and making sure they are good/organized. These extremes can be said to between gibberish mess and nothing said/done.
BryanFRitt
Posts: 219
Joined: Mon Nov 13, 2017 4:16 pm

Re: Write to a temp file 1st.

Post 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.
Life is partially trying to strike a balance between generating new things/ideas, and making sure they are good/organized. These extremes can be said to between gibberish mess and nothing said/done.
User avatar
Holger
Site Admin
Posts: 4073
Joined: Fri Jun 18, 2004 4:13 pm
Location: Germany
Contact:

Re: Write to a temp file 1st.

Post 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.
Post Reply