TASEmulators / TASEmulators/BizHawk

BizHawk crashes during saving when save files are in use by other processes (Dropbox)

Open
#4,258 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

App: EmuHawk Repro: Affects 2.10.1 dev Repro: Patch pending
Dominant language
C#
Stars
2.8k
Forks
468
PR merge metrics
No merged PRs in 30d

Description

Summary

When BizHawk attempts to save to a file that is being accessed by Dropbox, an error dialog will pop up, then BizHawk will crash entirely.

I'm on Windows, using a personally modified version of BizHawk forked from late 2.9 cc0f1417f1fa64fa267896a45c55417f707428dc, with some minor changes to file extensions - nothing that would affect this.

Ideally this should fail and try again later, rather than crash the entire program.

I've tried to find similar issues and can't find any, apologies if I missed any. I also apologise if this has been fixed with 2.10.

Repro
  1. Run BizHawk while its save directory is pointed at a directory managed by Dropbox.
  2. Play a game, optionally with autosaving enabled.
  3. Wait for a clash between BizHawk autosaving and Dropbox syncing.
Output
System.IO.IOException: The process cannot access the file 'C:\Users\Ladybunne\Dropbox\Media\Games\Emulation\SaveRAM\GBA\Yu-Gi-Oh! - Ultimate Masters - World Championship Tournament 2006 (USA) (En,Ja,Fr,De,Es,It).Autosave.srm.bak' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileInfo.Delete()
   at BizHawk.Client.EmuHawk.MainForm.FlushSaveRAM(Boolean autosave) in C:\Users\Ladybunne\repos\BizHawk\src\BizHawk.Client.EmuHawk\MainForm.cs:line 2002
   at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force) in C:\Users\Ladybunne\repos\BizHawk\src\BizHawk.Client.EmuHawk\MainForm.cs:line 3051
   at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop() in C:\Users\Ladybunne\repos\BizHawk\src\BizHawk.Client.EmuHawk\MainForm.cs:line 897
   at BizHawk.Client.EmuHawk.Program.SubMain(String[] args) in C:\Users\Ladybunne\repos\BizHawk\src\BizHawk.Client.EmuHawk\Program.cs:line 352
Host env.

Image

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/BizHawk.Client.EmuHawk/MainForm.cs at MainForm.FlushSaveRAM, identified in the stack trace around line 2002, and follow its call from the save loop. Reproduce an autosave while Dropbox holds the .bak file; done means the lock no longer crashes BizHawk and the save failure is handled as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.