Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
cadamsdev opened this issue Feb 1, 2018 · 37 comments

Comments

@cadamsdev
Copy link

cadamsdev commented Feb 1, 2018

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.

@cadamsdev cadamsdev changed the title Unable to write to file Unable to write to file xxxx file in use, locked or lacking permissions Feb 1, 2018
@Zylann
Copy link
Contributor

Zylann commented Feb 1, 2018

Duplicate of #14339

Do you have an antivirus running?

@cadamsdev
Copy link
Author

cadamsdev commented Feb 1, 2018

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

@vnen
Copy link
Member

vnen commented Feb 1, 2018

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).

@cadamsdev
Copy link
Author

cadamsdev commented Feb 1, 2018

@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 :(

@Ace-Dragon
Copy link

Ace-Dragon commented Feb 2, 2018

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.

@RayKoopa
Copy link
Contributor

RayKoopa commented Feb 2, 2018

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

@RayKoopa
Copy link
Contributor

RayKoopa commented Feb 2, 2018

I recall they turned out correct though

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

@Calinou
Copy link
Member

Calinou commented Feb 5, 2018

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.

@DaDude
Copy link

DaDude commented Feb 9, 2018

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 ;)

@akien-mga
Copy link
Member

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.

@abFrancisco
Copy link

abFrancisco commented Mar 12, 2018

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

@LiamDobbelaere
Copy link
Contributor

LiamDobbelaere commented Mar 24, 2018

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.

@LiamDobbelaere
Copy link
Contributor

LiamDobbelaere commented Mar 25, 2018

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

@cadamsdev
Copy link
Author

@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.

@akien-mga akien-mga changed the title Unable to write to file xxxx file in use, locked or lacking permissions Unable to write to file xxxx file in use, locked or lacking permissions (Windows 10) Mar 26, 2018
@akien-mga
Copy link
Member

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.

@vnen
Copy link
Member

vnen commented Mar 26, 2018

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.

@LiamDobbelaere
Copy link
Contributor

LiamDobbelaere commented Mar 27, 2018

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.

@LiamDobbelaere
Copy link
Contributor

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.

@LiamDobbelaere
Copy link
Contributor

LiamDobbelaere commented Mar 30, 2018

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.

@akien-mga
Copy link
Member

Fixed by #17869, thanks @TomDobbelaere 🎉

@drako0812
Copy link

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

@LiamDobbelaere
Copy link
Contributor

Does it still occur when disabling Avast temporarily?

@Banderi
Copy link

Banderi commented Sep 28, 2018

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

@Zylann
Copy link
Contributor

Zylann commented Oct 23, 2018

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.

@bmolyneaux
Copy link
Contributor

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

@EpproxZimlon
Copy link

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

I'm using Godot with Steam installation.

@Ace-Dragon
Copy link

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.

@Toshiwoz
Copy link
Contributor

Toshiwoz commented Jul 4, 2019

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.

@mcbits
Copy link

mcbits commented Jul 15, 2019

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.

@nathanfranke
Copy link
Contributor

nathanfranke commented Dec 27, 2019

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

@nathanfranke
Copy link
Contributor

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

@Calinou
Copy link
Member

Calinou commented Jul 2, 2020

@nathanfranke There's already an open issue about the same problem: #6393

@mobiusstrip
Copy link

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.

that was a bruh moment 🤦

@JoeBlackSci
Copy link

I'm Still having this issue.

Windows 10, no antivirus running.

@Koyasha
Copy link

Koyasha commented Aug 8, 2023

I have this issue in Godot 4.0 on Win 10 when running scenes in one of the 3d projects. Other projects are fine.

AV disabled. Tried running as admin to no avail.

@robbiesaurus
Copy link

Issue still exists on v4.1.2 on windows 10, please re-open this ticket. No antivirus and running Godot as admin does not fix the issue.

@Calinou
Copy link
Member

Calinou commented Nov 13, 2023

Please open a new issue with a minimal reproduction project attached, as the exact cause is likely different nowadays compared to the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests