Godot: Unable to write to file xxxx file in use, locked or lacking permissions (Windows 10)

Created on 1 Feb 2018  路  34Comments  路  Source: godotengine/godot

Apologize if there's an issue for this already.

Godot version:
3.0 stable

OS/device including version:
Windows 10, Nvidia GTX 1070

Issue description:
I get this extremely annoying popup that says "Unable to write to file xxx file in use." This happens very frequently but not everytime. This issue is very tedious for Windows users.

I am using both Avast and Malwarebytes.

https://i.imgur.com/X61a9wv.png

Steps to reproduce:
I get this issue trying to open up or save files.

bug confirmed hero wanted! windows editor

Most helpful comment

For anyone still encountering this: Make sure your debugger has stopped! I was banging my head on the desk over a mysteriously locked scene until I realized my game had a bug such that closing the game window didn't actually kill the process. Stopping the debugger released the file, and I switched to banging my forehead on my palm.

All 34 comments

Duplicate of https://github.com/godotengine/godot/issues/14339

Do you have an antivirus running?

@Zylann Yes, I'm using Avast and Malwarebytes.

none of your files will save when the message pops up.

I'm pretty sure it saves all the files that are not in the message (sometimes they're saved even when they are in the message).

@vnen Couldn't it be possible for more than 1 file to be locked at once? The popup is not going to show you all the files currently locked. (I could be wrong) Though I've had issues where I was using a gdscript for player then switched to a visual script tried to save and godot still thought I was using a gdscript for player. I had to eventually restart godot :(

I have the same issue using AVG as my antivirus (Win10 Fall Creator's update).

This has been an issue in Godot 3 builds for months (back to the alpha versions), so it's not a recent commit that created it. This usually happens either when saving a scene or when starting the game.

Maybe it's related to a bad use of Win API?

@RayKoopa cc

baseless assumption tho, and I have no time to check atm sorry :p

I thought I had a friend. 馃敨

Noprob bro. But ye, I've checked it before and we argued about the weird Unicode tricks.

I recall they turned out correct though

I'm nobodies friend, except akiens maybe, but he doesn't accept me...

I've had this happen on Windows 10 without any antivirus (and Windows Defender disabled). I haven't tested it since December 2017 since I'm on Linux now, but I figure it still happens.

I'm almost sure Godot is locking the files at least in some cases.
I recently stumbled upon this bug myself when reimporting all of my assets after cloning my repository.
Some of my stex files were broken afterwards so i just deleted everything in the .import folder so i would get a fresh start.

Then i observed something strange:
Sometimes when the "(Re)importing Assets" progressbar appears, it stays at 0% and the UI locks up completely. After a few seconds all files were imported properly.
But when the UI didn't lock up and the progressbar showed it's progress properly there were one or more broken files in the .import directory.

I tried this a few more times on different machines all running Windows 10, no antivirus and no Windows Defender enabled and this was 100% reproduceable.
I don't know if this helps at all, but maybe someone can derive a proper explanation or fix from this.
And if i can try something else to help just say a word ;)

Sometimes when the "(Re)importing Assets" progressbar appears, it stays at 0% and the UI locks up completely. After a few seconds all files were imported properly.
But when the UI didn't lock up and the progressbar showed it's progress properly there were one or more broken files in the .import directory.

That's quite interesting. It wouldn't be the first time that the EditorProgress bar causes weird issues.

This happens to me when i have a MEGASync running in that folder on 3.0 stable
It stops happening if i exit MEGASync, should be the same with most cloud sync applications

Please fix this, I've tried so many things and Godot has genuinely become unusable for me, this is what I've tried:

  • Running as Administrator
  • Removing Godot directory from %appdata% so it is recreated
  • Giving Godot directory from %appdata% permissions for Everyone and unchecking read-only
  • Moving Godot exe from Documents to Program Files
  • Running a newer (3.1 dev LSW) release
  • Turning off OneDrive, Dropbox or other cloudsync applications
  • Turning off Antivirus
  • Allowing Godot in Windows Firewall for in- and outbound

It's gotten even worse now for no good reason, with the editor locking up anytime it happens.
Please please focus all your efforts on fixing this, it's a glaring issue.

I installed Godot on my tower, made a small sample project that imports a texture, has a sprite node with some code that is an instantiated scene.
Haven't had the pop-up once yet. I'll have to check if there's something specific to my laptop's confiugration causing the file locking issue.

Edit: After having restarted my laptop in safe mode, then diagnostics and back to normal I'm not getting the issue atm. When it comes up again I'll try to slowly kill processes and services to see what it might be.

Edit 2: It actually did come back in the end, I haven't found a correlation yet

@TomDobbelaere I second this. Godot is also unusable for me as well because of this issue. I have tried disabling 3rd party Antiviruses and Window defender and still get this issue.

As far as I understand, this affects only Windows 10 users? Would need an experienced Windows 10 dev to profile the file accesses and see what Godot can do to workaround Windows' restrictions.

I do think it's Godot that's locking the files. I have seen this with the thumbnails if I save the scene twice in a row. Probably the editor is trying to access the file before the last run has released the handle.

Can confirm, usually happened for me when it said something about generating/saving Thumbnail.
The issue ended up coming back anyway, even after restarting my laptop.

For anyone willing to contribute, the file in question is file_access_windows.cpp, in particular the if (rename_error && close_fail_notify).

The comments mention paranoid antiviruses causing the issue by checking even non-executable files when writing them, though I doubt whether this is true since disabling my antivirus didn't help.

Okay, I haven't fixed the file renaming issue, but someone didn't think while writing the 'retry' code. I'll reference a commit in just a moment. This gets rid of the annoying errors while still telling you if it didn't save correctly.

Fixed by #17869, thanks @TomDobbelaere :tada:

I just wanted to say I'm still occasionally getting this problem in Godot 3.1 Alpha 1 (with and without Mono). It's possible that I have an underperforming computer that has problems keeping up with the filesystem access. Usually I have no problems if I make sure to save again right after the error window pops up, and this problem is nowhere near as bad as it was a few months ago.

System Information

OS: Windows 10 Home 64-bit
CPU: AMD A10-5750M
RAM: 8 GiB DDR3 @ 1600 MHz
HDD: 1 TB Seagate 5400 RPM SSHD (Upgraded from original HDD)
Antivirus: Avast Free Antivirus

Does it still occur when disabling Avast temporarily?

I have no AV running, including any that Windows has out of the box, and I still get this issue (slightly different location than that of the OP's image)

Deleting the entire Godot folder in AppData/Local/Temp fixes it for a while, but keeps coming back after prolonged usage;

OS: Windows 7 Pro 64-bit
CPU: Intel Core i7 8700K
RAM: 16 GB DDR4
Antivirus: N/A

output
output

I am getting this too almost everytime I save in Godot 3.1 alpha1, on a computer that has no antivirus installed other than the default Windows one.

Windows 10 64 bits
No third party antivirus

image

With this error in the console:

ERROR: close: Condition ' rename_error ' is true.
   At: drivers/windows/file_access_windows.cpp:176

Interestingly, that's the same computer model as mine, but I don't remember getting the problem on mine.
On the other hand, my own computer has known delays when writing to disk after being idle for more than a few minutes (probably the HDD or builtin security slowly kicking in), but that never made the problem occur.

I have this issue in v3.1.stable.official trying to save a gdscript. I'm on Windows without antivirus or version control.

Think I'll try Unity until this issue with Windows 10 is fixed.

I'm using Godot with Steam installation.

I just want to place in here that I at least don't get this error anymore (with Win10 64 bit April Update, using AVG as the anti-virus software).

So this bug doesn't affect near as many setups now, but it looks like this is still ongoing with a few people.

Hi, I'm also still experiencing this in version 3.1.1, sporadically, and I believe especially with larger files, or when the computer is already busy reading/writing.

For anyone still encountering this: Make sure your debugger has stopped! I was banging my head on the desk over a mysteriously locked scene until I realized my game had a bug such that closing the game window didn't actually kill the process. Stopping the debugger released the file, and I switched to banging my forehead on my palm.

Getting this with beta 4 on my Windows 10 machine
I get it if I try saving too many times in a second or so and I interrupt the save

EDIT: @mcbits is correct, you can fix this by hitting the stop button on the top right

If this is confirmed then we should re-open the issue :stuck_out_tongue:

@nathanfranke There's already an open issue about the same problem: https://github.com/godotengine/godot/issues/6393

Was this page helpful?
0 / 5 - 0 ratings