-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Saving on Windows succeeds but shows error message dialog (due to file locking limitations) #6393
Comments
Looking further, this only happens when stopped with error in debugger. |
do you have the script files opened by something else, like an external editor? |
I've seen this, usually when the scene is running, but I can't reproduce reliably. |
For me the scripts are not open in a separate editor, and I was getting this sporadically but now it's just about every save. Godot 2.1.1 on win7x64. |
Yeah this bug really slowed down my save/reload cycle.... |
Perhaps this needs to be re-opened. |
I would say so...not to be a snob about it but I stuck it through for LD 37, but would not want to use Godot again until that was fixed. Not a show-stopper but a real grind-it-to-a-near-halt-er with no obvious workaround. It seemed like every 10th save sometimes, or sometimes every 2nd save, would just mysteriously work. You're not supposed to run as admin or anything, are you? |
I had no TortoiseGit running, or Dropbox/Google drive. Seemed to just be windows holding the file handle sometimes. |
Isn't it that the currently running game is holding the file handle, or am I wrong? |
Sorry @bojidar-bg but it couldn't be that way even if I wanted to--my game captures the mouse, so I almost always exited it to return to the GUI, unless I was inspecting something in-game. I just tried it now to be sure, and the game definitely isn't running when I get the error. |
Then.. maybe the editor has the handle? 😄 |
Then shouldn't it...you know...use it to save the file? |
@IBwWG All bugs are about a "shouldn't it", and this one is deep within drivers/windows probably. |
But, if Godot is still holding an open file handle, shouldn't it tell Windows to close it when it's done with it? (I have no idea if the problem is Windows or Godot, but I don't have this problem with other programs. What makes you think it's Windows rather than Godot?) One other thing I noticed: it's complaining about main.scn, which I have to have open in order to save (otherwise it tells me I need to have a root file open) and run the project. I have it open, but I am not touching it at all between saves: I'm purely editing .gd files. Is that behaviour itself maybe part of the problem? |
I have this problem to, aslo with the 2.1.3 RC1, can't tell but, can it be because I also tried with the 3.0 version compiled by the fixnum guys(http://fixnum.org/godot/)? I've also noticed that this issue prevents godot from generating scenes preview (or thumb, or preview, dunno hot to call it). I didn't had this problem since the beginning. |
Same thing withRC2 and now with the fresh new stable release. |
And by the way it is also happening when editing scenes or saving editor config. The, how do yu call it.. debug window? Tells me the error is this: ERROR: FileAccessWindows::close: Condition ' rename_error ' is true.
At: drivers\windows\file_access_windows.cpp:130
ERROR: SpatialIndexer::_update_camera: Condition ' !E ' is true.
At: scene\resources\world.cpp:125 And here is the code it is referring to: if (!PathFileExistsW(save_path.c_str())) {
#endif
//creating new file
rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0;
} else {
//atomic replace for existing file
rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
} Can it be that the .tmp files instead of being renamed are copied and then when it tries to create again the .tmp file it fails? (sorry I am going to sleep, don't have enough time to look into that deeper) |
Godot does not keep handles open to existing files, it is likely thar the
text editor you are using does, so Godot is unable to save over them. Does
it happen with other text editors?
…On Apr 15, 2017 5:35 AM, "Toshio Araki" ***@***.***> wrote:
And by the way it is also happening when editing scenes or saving editor
config.
[image: image]
<https://cloud.githubusercontent.com/assets/21297356/25060359/da190f24-2160-11e7-8362-1b53e5f58c0a.png>
The, how do yu call it.. debug window? Tells me the error is this:
ERROR: FileAccessWindows::close: Condition ' rename_error ' is true.
At: drivers\windows\file_access_windows.cpp:130
ERROR: SpatialIndexer::_update_camera: Condition ' !E ' is true.
At: scene\resources\world.cpp:125
And here
<https://github.com/godotengine/godot/blob/master/drivers/windows/file_access_windows.cpp>
is the code it is referring to:
if (!PathFileExistsW(save_path.c_str())) {
#endif
//creating new file
rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0;
} else {
//atomic replace for existing file
rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
}
Can it be that the .tmp files instead of being renamed are copied and then
when it tries to create again the .tmp file it fails? (sorry I am going to
sleep, don't have enough time to look into that deeper)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6393 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z21l6URkaTW70lxXFkkRwtcKQyYS6ks5rwDrmgaJpZM4J0jlH>
.
|
This only happens if a handle to the file is opened while godot tries to
save.. I think there are ways in windows to ask who is owning the file lock
…On Apr 15, 2017 6:20 AM, "Juan Linietsky" ***@***.***> wrote:
Godot does not keep handles open to existing files, it is likely thar the
text editor you are using does, so Godot is unable to save over them. Does
it happen with other text editors?
On Apr 15, 2017 5:35 AM, "Toshio Araki" ***@***.***> wrote:
> And by the way it is also happening when editing scenes or saving editor
> config.
> [image: image]
> <https://cloud.githubusercontent.com/assets/21297356/25060359/da190f24-2160-11e7-8362-1b53e5f58c0a.png>
>
> The, how do yu call it.. debug window? Tells me the error is this:
>
> ERROR: FileAccessWindows::close: Condition ' rename_error ' is true.
> At: drivers\windows\file_access_windows.cpp:130
> ERROR: SpatialIndexer::_update_camera: Condition ' !E ' is true.
> At: scene\resources\world.cpp:125
>
> And here
> <https://github.com/godotengine/godot/blob/master/drivers/windows/file_access_windows.cpp>
> is the code it is referring to:
>
> if (!PathFileExistsW(save_path.c_str())) {
> #endif
> //creating new file
> rename_error = _wrename((save_path + ".tmp").c_str(), save_path.c_str()) != 0;
> } else {
> //atomic replace for existing file
> rename_error = !ReplaceFileW(save_path.c_str(), (save_path + ".tmp").c_str(), NULL, 2 | 4, NULL, NULL);
> }
>
> Can it be that the .tmp files instead of being renamed are copied and
> then when it tries to create again the .tmp file it fails? (sorry I am
> going to sleep, don't have enough time to look into that deeper)
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#6393 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AF-Z21l6URkaTW70lxXFkkRwtcKQyYS6ks5rwDrmgaJpZM4J0jlH>
> .
>
|
No entiendo, I'm using godot only, no text editor. |
Maybe some recent commit or pr relate to windows backend for for file
access broke this?
…On Sat, Apr 15, 2017 at 4:49 PM Toshio Araki ***@***.***> wrote:
No entiendo, I'm using godot only, no text editor.
The function ReplaceFileW does a replace. So as far as I understand it
takes, for example, the editor_settings.tres doing a copy of it as a .tmp
file, and up to that it works fine, then it tries to replace the content of
the original file with the .tmp one, and here I think is where it fails.
To me it's probable that it's godot itself not releasing handle of the
files when it should. Or that function has some wrong parameters.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#6393 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AF-Z27SyMadtziGM_bayn-O-Tm5sN-1xks5rwNj-gaJpZM4J0jlH>
.
|
@WolfGangsta Does the situation improve if you add the Godot executable to the list of executables ignored by Windows Defender? Alternatively, try adding Documents and |
Unfortunately, no. The same error messages are generated on starting the Project Manager as before:
Trying to open a test project file directly from File Explorer:
|
@WolfGangsta try using the editor from a non-common folder (not on user directories or program files) and use the |
Aha! I created a new "Godot Editor" folder in the root C: directory and stuck the executable there. Editing, saving, etc. works now, and I didn't have to use self-contained mode. The editor's data remains happily in my user's AppData folder. Thanks for the help! It does seem a little hacky, though--as a Windows user, I'd expect to find the program in Program Files or some other common directory. I never saw any general recommendation on where to put the .exe, which is why I experimented with putting it in different places to start with. Maybe the issue is that we need more documentation on the subject of Windows "installation"? |
If you want to install a program user-wide in a standard location, create a folder in
See #8057. Note that the Godot community is quite attached to the concept of not having to install Godot, so installers will be completely optional if they're ever released. PS: You may be interested in Scoop 🙂 # After installing Scoop, run this in a command prompt:
scoop bucket add extras
scoop install godot |
Windows package managers like Scoop are getting popular among devs, Godot is on Chocolatey too.
|
Gotcha. Thanks for the help! (And sorry for the late reply.) I'll look into Scoop and Chocolatey--they look like just what I need to simplify things. |
To any of you experiencing this issue, does disabling Filesystem > On Save > Save Safe On Backup Then Rename in the Editor Settings improve the situaton? |
Okay guys idk if this may help you but i tried to OC my processor so i installed 2 logiciel to monitoring my core: |
Turning this off avoids the issue it seems. |
it doesn't improve the situation, it just changes it with this setting enabled i get the standard "unable to write to file" error with this setting disabled i instead get the delightfully unhelpful error "alert! error while saving" with absolutely no other information at all. in either case, the save is successful - i'm just hassled by an error. this isn't some minor annoyance: this has already caused alarm fatigue. now that i know saves are successful despite this error, i completely ignore these |
Which Godot version are you using? This might actually be fixed in 3.3.3. |
my bad, i was using 3.3.2 - i just updated and you're right, the latest version has fixed this issue. thanks for pointing that out. |
This should be fixed in 3.3.3 thanks to #51430, closing. Please comment if you can still reproduce this on 3.3.3 or later. |
If you can only reproduce this in a Mono-enabled build, then it's a different issue. |
Is there an issue#/link for this occurring with a Mono-enabled build? Just want to figure out why I am seeing it in a 3.4-stable Mono build. |
I can't see any open issue about this, so please create a new issue with a minimal reproduction project attached. |
I installed the latest stable non-Mono Godot and it had the same issue. My current guess is this is a misleading error message because the project is in an abnormal state. I am trying to create a GDNative plugin. Along the way, the DLL name changed, so the .gdns file would not load. In the IDE, I deleted it in the IDE, but it looks like it did not delete the references. So then it complained that the scene had a missing reference, and I tried to use the Fix Problems, but the IDE does not appear to have a way of removing the dependency. Then you get this message. So I started over with a fresh Godot project. Thank you. Sorry about the post, but I was trying to figure out what the problem was, and thought this issue was mine. |
Same here. But thanks to Below comment. I was able to fix this.
|
Operating system or device - Godot version:
Windows 7 64 bit professional
Issue description (what happened, and what was expected):
Editing and saving a script repeatedly seems to cause the following error:
Unable to write to file 'e:/proj/myproject/script/test.tscn' , file in use, locked or lacking permissions.
This is in the log:
ERROR: FileAccessWindows::close: Condition ' rename_error ' is true.
At: drivers\windows\file_access_windows.cpp:139
ERROR: FileAccessWindows::close: Condition ' rename_error ' is true.
At: drivers\windows\file_access_windows.cpp:139
Steps to reproduce:
Just changing and editing a script file seems to cause it.
Link to minimal example project (optional but very welcome):
The text was updated successfully, but these errors were encountered: