Author Topic: [BUG][PLAYER] "An error occurred while trying to save data"  (Read 4168 times)

0 Members and 1 Guest are viewing this topic.

Offline WillLem

  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
[BUG][PLAYER] "An error occurred while trying to save data"
« on: March 22, 2020, 04:50:36 AM »
Not sure what I've done wrong, but I'm seeing this in between almost every level load, and at other random times as well.
« Last Edit: January 08, 2021, 12:27:11 AM by WillLem »

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #1 on: March 22, 2020, 06:15:32 AM »
Do you:
a) have multiple instances of NeoLemmix running at once?
b) have any of the files in the "settings" folder open in another app (such as a text editor)?
c) have your NeoLemmix folder anywhere it'd be automatically backed up?
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline WillLem

  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #2 on: March 22, 2020, 09:15:36 AM »
c) have your NeoLemmix folder anywhere it'd be automatically backed up?

This one: my desktop gets automatically backed up to my GDrive, and the NeoLemmix folder is on the desktop. I'm guessing I should move it?

But, I like that it automatically gets backed up tbh... I guess I can put up with the odd error message. It's not all that frequent, actually. And it usually happens more when I've changed something (for example, added a new levelpack or moved stuff around within NL's folders), so this would explain it.
« Last Edit: March 22, 2020, 09:45:10 PM by WillLem »

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #3 on: March 22, 2020, 10:14:12 AM »
Okay, so - this is likely happening because GDrive is trying to back up the config file, at the same time as NL is trying to save it. NL saves the configuration (and progress) every time you move between screens, as well as upon exiting.

My initial thought here:
- When transitioning between screens, if the files can't be saved, fail silently (ie: just accept that saving failed, and continue without saving, without displaying an error)
- When exiting NeoLemmix, if the files can't be saved, either wait a short time and try again (a few seconds), or save to an alternate filename and alert the user

Perhaps also, some tracking of if the contents have changed (or at least if they've potentially changed; eg. simply check "has the user opened the config dialog since the last time settings were saved?").
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline Proxima

  • Posts: 4562
    • View Profile
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #4 on: January 14, 2022, 09:07:22 PM »
I asked namida in discord to bump this. I've been having this problem now that I'm on a Windows 10 machine with OneDrive, and namida thinks it might be possible to fix.

Offline WillLem

  • Posts: 3345
  • Unity isn't sameness, it's togetherness
    • View Profile
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #5 on: January 14, 2022, 10:12:31 PM »
This only ever happens when GDrive is running. If I pause syncing (or if it's otherwise inactive), it doesn't happen. GDrive also interferes with a number of other processes, like saving or loading levels which are currently being synced.

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #6 on: January 15, 2022, 04:47:24 PM »
I asked namida in discord to bump this. I've been having this problem now that I'm on a Windows 10 machine with OneDrive, and namida thinks it might be possible to fix.

Not so much fix per se, but rather, possible to implement workarounds for, based on either (a) just accepting failure silently in cases where saving is not critical, and (b) in cases where it is critical (or at least as close to that as saving your settings in a Lemmings clone comes :P ), respond to failure by waiting a short time then trying again, raising an error message only in the case of repeated failure (after perhaps 3 attempts).
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)

Offline namida

  • Administrator
  • Posts: 12398
    • View Profile
    • NeoLemmix Website
Re: [BUG][PLAYER] "An error occurred while trying to save data"
« Reply #7 on: December 04, 2022, 01:09:12 AM »
Commit 5821a2a implements a changed behavior in the case of failure to save settings.

The new behavior is that there are three "criticality" states for saving user data - "none", "important" and "critical". Most cases of saving data are set to "none". After using the configuration menu, "important" is set, and when exiting NeoLemmix, "critical" is set.

When the state is "none", if saving fails, NeoLemmix waits 50ms and tries again. If this too fails, NeoLemmix silently continues, but sets a flag so that the next save attempt will be (at least) handled as "important".

When the state is "important", NeoLemmix will make up to 5 attempts to save (again seperated by 50ms). Much like above, failure involves silent continuing, and the next save attempt will be handled as "critical" no matter what.

Only if the state is "critical", and 10 failed attempts occur, at this point an error message will be displayed. I'm considering also attempting to save the new configuration / save data to a new file in this case, which a user could then manually replace the actual ones with.
My Lemmings projects
2D Lemmings: NeoLemmix (engine) | Lemmings Plus Series (level packs) | Doomsday Lemmings (level pack)
3D Lemmings: Loap (engine) | L3DEdit (level / graphics editor) | L3DUtils (replay / etc utility) | Lemmings Plus 3D (level pack)