chrismaltby / gb-studio

A quick and easy to use drag and drop retro game creator for your favourite handheld video game system
https://www.gbstudio.dev
MIT License
8.57k stars 472 forks source link

Crashes if project file is synced with Dropbox #435

Open bloomengine7 opened 4 years ago

bloomengine7 commented 4 years ago

On Windows 10, saving a project in a folder with Dropbox sync enabled will cause GB Studio to crash. Other programs have no problem with Dropbox.

To reproduce: create a new project within a folder that is synced with Dropbox. Make some changes, and save several times. It will eventually crash.

Here are the logs: Error: EBUSY: resource busy or locked, rename 'C:[snipped]/[crash_test.gbsproj.new' -> '[snipped]/crash_test.gbsproj' at renameSync (fs.js:591:3) at writeError (C:[snipped]\AppData\Local\gb_studio\app-1.2.1\resources\app.asar\src\lib\helpers\fs\writeFileWithBackup.js:38:26) at closeError (C:[snipped]\AppData\Local\gb_studio\app-1.2.1\resources\app.asar\src\lib\helpers\fs\writeFileAndFlush.js:36:49) at C:[snipped]\AppData\Local\gb_studio\app-1.2.1\resources\app.asar\node_modules\graceful-fs\graceful-fs.js:57:14 at FSReqWrap.oncomplete (fs.js:141:20)

I depend on Dropbox for backup and working between different machines. Hopefully it's not too hard to fix. I understand it may not be huge priority but if there's any way to fix I'd greatly appreciate it.

Thanks for the excellent program!

Bliz71 commented 4 years ago

I'm having the same problem. As a temporary work around I'll save my projects in a non-dropbox folder and copy into dropbox to back up. But it would be nice to use the advantages of dropbox because I move from laptop to desktop a lot and rely on dropbox to keep my files synced.

Here's the error printout

Error: EBUSY: resource busy or locked, rename 'D:\Dropbox_NoYetis\Dropbox (Personal)\MY_ASSETS\GB_Studio_Games\SpaceGame001\SpaceGame001.gbsproj.new' -> 'D:\Dropbox_NoYetis\Dropbox (Personal)\MY_ASSETS\GB_Studio_Games\SpaceGame001\SpaceGame001.gbsproj'
at renameSync (fs.js:643:3)
at file:///D:/Dropbox_NoYetis/Dropbox%20(Personal)/MY_ASSETS/GB_Studio_Games/GB-Studio-Windows-64bit-standalone-2.0.0-beta1/GB%20Studio-win32-x64/resources/app.asar/.webpack/renderer/main_window/index.js:333:103243
at file:///D:/Dropbox_NoYetis/Dropbox%20(Personal)/MY_ASSETS/GB_Studio_Games/GB-Studio-Windows-64bit-standalone-2.0.0-beta1/GB%20Studio-win32-x64/resources/app.asar/.webpack/renderer/main_window/index.js:333:102950
at file:///D:/Dropbox_NoYetis/Dropbox%20(Personal)/MY_ASSETS/GB_Studio_Games/GB-Studio-Windows-64bit-standalone-2.0.0-beta1/GB%20Studio-win32-x64/resources/app.asar/.webpack/renderer/main_window/index.js:7:28954
at FSReqCallback.oncomplete (fs.js:146:23)
RichardULZ commented 4 years ago

https://discord.com/channels/554713715442712616/575070105919029295/748904422125469787 Experimented with a solution, but could not reproduce the error with dropbox personally.

I assume the error is caused by the save system creating .gbsproj.new for safety, then renaming it to overwrite .gbsproj too quickly while dropbox is locking the .gbsproj.new file.

We might be able to catch the error, and wait a few seconds before trying to rename the file again, hopefully after dropbox has unlocked the file.

RichardULZ commented 4 years ago

Another user reproduced this issue by saving rapidly while in a drop box folder. https://discord.com/channels/554713715442712616/570925559346102273/763931111000375306 Not sure if it's also related to hdd or internet speed, will attempt to push this possible fix from last month, but was not able to reproduce the error before.

Error: EPERM: operation not permitted, rename 'C:\Users\KyleL\Dropbox\Projects\Solar Surfer\Solar Surfer 1.3 (Rebuild)\Solar Surfer 2.0.gbsproj.new' -> 'C:\Users\KyleL\Dropbox\Projects\Solar Surfer\Solar Surfer 1.3 (Rebuild)\Solar Surfer 2.0.gbsproj'
at Object.renameSync (fs.js:643:3)
at file:///C:/Users/KyleL/Downloads/GB%20Studio-win32-x64/resources/app.asar/.webpack/renderer/main_window/index.js:215:55323
at file:///C:/Users/KyleL/Downloads/GB%20Studio-win32-x64/resources/app.asar/.webpack/renderer/main_window/index.js:76:29372
at file:///C:/Users/KyleL/Downloads/GB%20Studio-win32-x64/resources/app.asar/.webpack/renderer/main_window/index.js:1:5816
at FSReqCallback.oncomplete (fs.js:146:23)