godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.17k stars 20.21k forks source link

Sporadic .tmp files are left in the project source (Windows) #82270

Open voithos opened 12 months ago

voithos commented 12 months ago

Godot version

4.1.1.stable

System information

Godot v4.1.1.stable - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (NVIDIA; 31.0.15.2849) - 13th Gen Intel(R) Core(TM) i9-13900K (32 Threads)

Issue description

I noticed today a rogue .tmp file present in the source tree that I didn't recognize:

$ git status
?? scenes/sandbox/sanEC90.tmp

It appears to be a backup / temp file for one of the .tscn files. From some quick searches, it seems a similar issue happened in the past for Windows (https://github.com/godotengine/godot/issues/956), and indeed I'm developing on Windows. Also, I noticed a reddit post about this issue not too long ago (https://www.reddit.com/r/godot/comments/16akyka/what_are_all_these_tmp_files_alongside_my_main/), so it seems likely that an issue has resurfaced.

I've never packaged my project, just normal usage and edit / play. At times when the GDScript type checking seems to get confused, I will reload the project from the Project menu.

Steps to reproduce

It seems pretty random/sporadic, so I haven't been able to reproduce it consistently (and in fact have only seen a single instance of such files). Just wanted to open a tracking bug since it seems others are running into it as well.

Minimal reproduction project

N/A

bitsawer commented 12 months ago

Those file names do look like Godot editor temp files on Windows. There have been a few tweaks to the Windows temp file handling in https://github.com/godotengine/godot/pull/81001, should be in Godot 4.2. Still, in case you have something like an aggressive anti-virus blocking file access while it's doing scanning, it might not be enough.

Meanwhile, if the files get too annoying, you can disable this in Editor -> Editor Settings -> FileSystem -> Safe Save on Backup then Rename.

voithos commented 12 months ago

Good to know, I'll keep an eye out for it after 4.2 stable.

For now it doesn't bother me too much, so I've just added a line in my .gitignore to ignore *.tmp files.

AThousandShips commented 11 months ago

I cannot replicate this on 4.2, so does seem to be solved, if someone else can verify

levidavidmurray commented 10 months ago

@AThousandShips This has been happening pretty sporadically for me in 4.2.rc1—specifically with GDExtensions. I originally opened an issue in the godot-jolt repo: https://github.com/godot-jolt/godot-jolt/issues/690

*.TMP files are being created for the extension DLL that aren't getting cleaned up. I'm unsure how to reproduce the *.TMP files persisting, but you can see them here:

https://github.com/godotengine/godot/assets/46084870/c2509483-28a8-458c-88b4-d0deb08dd3d4

DmitriySalnikov commented 9 months ago

I'm unsure how to reproduce the *.TMP files persisting, but you can see them here:

You can just open two editors for one project that uses GDExtension. Also, the opening of several editors breaks the registration of singletons.

318h7 commented 8 months ago

I’m getting this on windows with version 4.2.1-stable when adding nodes to tree from code, It looks like it stores the node information and fails to clean it up.

So is it safe to add the *.tmp to .gitignore?

Azengar commented 7 months ago

Hi, same here, I get this on 4.2.1-stable using C#. For me it seems to appear when I use FileAccess, even if I correctly close & dispose of the FileAccess object after using it.

The pain point being that they are actively used by the editor and thus cannot be deleted.

goshdarnheck commented 7 months ago

I've been able to consistently recreate this by clicking "run project" with a syntax error in a script, waiting for it to halt, and then updating and saving the script before stopping the game.

Saving fails with the error "Unable to write to file [path], file in use, locked or lacking permissions."

I'm guessing that a tmp file is created at this point and never removed when the save fails?

Zshandi commented 7 months ago

I am seeing these files show up randomly as well, in v4.2.stable.official [46dc27791]. There were a bunch that ended up in my friend's PR, which is where I first noticed it, and then I just recently saw them myself as well:

image

I think I may have seen the same error as @goshdarnheck with the "Unable to write to file [...]" message. It's a bit annoying we have to add these to the .gitignore now. Though, I suppose it doesn't hurt to have them in there, even if this issue is fixed, in case some other issue occurs which cause these files to appear.

FoxyFox909 commented 6 months ago

I've been able to consistently recreate this by clicking "run project" with a syntax error in a script, waiting for it to halt, and then updating and saving the script before stopping the game.

Saving fails with the error "Unable to write to file [path], file in use, locked or lacking permissions."

I'm guessing that a tmp file is created at this point and never removed when the save fails?

I reproduced it once when trying to save a script while the debugger was running. Windows 10, Godot 4.3.dev5.

hjk321 commented 5 months ago

Same here. I can reproduce this issue by editing and attempting to save a script while the game is running.

AndreasHassing commented 4 months ago

Used the following PowerShell script to remove existing .tmp-files and include the ignore in .gitignore:

Get-ChildItem -Recurse *.tmp | Remove-Item; "`n# Godot tmp files (https://github.com/godotengine/godot/issues/82270)`n*.tmp" >> .\.gitignore
gmikhail commented 1 week ago

I also get .tmp scene files in a new project created in the latest Godot version.

How to reproduce:

  1. Make a scene with a script which contains an error.
  2. Run (F5) the scene and get an error with Stack Trace.
  3. Without closing the game in the Godot Editor fix the error in the script and press Ctrl+S.
  4. You will get a scene saving error and a temporary file next to the running scene.

2024-09-09 152530

2024-09-09 152655

Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1060 with Max-Q Design (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 Threads)

vasiliyaltunin commented 1 day ago

I also have this problem with exact errors as gmikhail