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

[4.0] Error importing resources by drag and drop #53871

Closed
Gromph opened this issue Oct 16, 2021 · 13 comments · Fixed by #73214
Closed

[4.0] Error importing resources by drag and drop #53871

Gromph opened this issue Oct 16, 2021 · 13 comments · Fixed by #73214

Comments

@Gromph
Copy link
Contributor

Gromph commented Oct 16, 2021

Godot version

v4.0.dev.20211015.official

System information

Windows 10 21H1, Vulkan, Nvidia GTX 760 472.12

Issue description

When importing a resource such as a png from outside the project by dragging and dropping from file explorer to godot results in a blank white popup window titled Load Errors
image

The following error is logged to the console:
ERROR: Task 'reimport' already exists.
at: (editor/progress_dialog.cpp:159)

Attempting to close the Load Errors window results in Godot crashing.

Steps to reproduce

  1. Create New Project
  2. Find a png or jpg file in file explorer, drag and drop from file explorer to Godot

Minimal reproduction project

No response

@and-rad
Copy link
Contributor

and-rad commented Nov 26, 2021

Interestingly, this does not happen when importing multiple assets at the same time (v4.0.dev.custom_build [80e292b]).

@and-rad
Copy link
Contributor

and-rad commented Nov 26, 2021

This also seems to be a Windows-specific issue, I was not able to reproduce it on an Arch system (Plasma 5.23, X11).

I have a pretty strong hunch as to what's going on. When importing multiple files successfully, there are initially duplicates of every imported file in the resource explorer:
screenshot

After closing and opening the editor again, they're gone. They also never, at any point, exist in the file system. But setting a breakpoint right before the error dialog opens reveals what it would show if it didn't freeze first: Unable to write to file 'D:/Workspace/GodotBugs/ImportCrash/.godot/imported/btn_red.png-674f8267988f5f3f17553a6f0bc7173c.stex', file in use, locked or lacking permissions.

So my guess is that for whatever reason the editor is trying to create the imported asset twice (or at least perform some part of the import process twice), succeeding the first time and failing the second because the imported file already exists and is locked by the same import process.

@andyp123
Copy link

I am also having a lot of import issues in Godot 4.0 (#56216), and the duplicate resources was one of the things I noticed, despite there being no problems in 3.4 release. Deleting either one of the two resources crashes the editor, and as in this case, there is only a single resource after a restart.

@lufog
Copy link
Contributor

lufog commented Mar 6, 2022

@Gromph, I had similar problems importing wav files in version 4.0-alpha1, but now everything works fine for me. Also, I can't reproduce your problem on either v4.0.alpha3.official [256069e] or v4.0.alpha.custom_build [272b355]. Could you check it again on the latest alpha version? Perhaps your problem has already been fixed.

@Gromph
Copy link
Contributor Author

Gromph commented Mar 7, 2022

With Godot 4 Alpha 3 64 bit on Windows 10 I'm still seeing the same white window, and closing it crashes godot.

@ArnovanDoesburg
Copy link

Still having this issue on Godot 4 Alpha 3 64 bit on Windows 10. Whenever I drag and drop multiple resources in (.png files in my case) they also duplicate, crashing me when I try to remove them from the project too.

@KoBeWi
Copy link
Member

KoBeWi commented May 8, 2022

Can't reproduce in alpha7. Also Windows 10.

@KoBeWi KoBeWi moved this to To Assess in 4.x Priority Issues May 8, 2022
@and-rad
Copy link
Contributor

and-rad commented Jun 12, 2022

Me neither, I think this issue can be closed.

@KoBeWi KoBeWi closed this as completed Jun 12, 2022
Repository owner moved this from To Assess to Done in 4.x Priority Issues Jun 12, 2022
@nickjfrench
Copy link

Getting this issue on Godot 4 Beta 17. Dragging a single png into the Godot FileSystem causes the previously mentioned blank screen to pop up. Closing that crashes Godot.

After relaunch, I didn't get a duplicate file being created but the file seems to be imported fine now.

@deranjer
Copy link

deranjer commented Feb 6, 2023

Can confirm exact issue on Windows 11 running Godot 4 Beta 17.

@YuriSizov YuriSizov reopened this Feb 6, 2023
@offgrid-dev
Copy link

offgrid-dev commented Feb 8, 2023

Getting the same issue on Win10 running Godot 4 RC1. Importing single or multiple PNGs (tried JPEG as well) produces the same result. Importing a .TTF font also produced the issue, though importing a .WAV did not. A .GLTF file exported from Blender imported without incident, textures included.

Update: The issue seems to be gone in my project now. I selected everything in .godot/imported and deleted it all. The editor took a moment to re-import everything, and I've since been able to import all of the above file formats without issue.

@YuriSizov YuriSizov moved this from Done to Todo in 4.x Priority Issues Feb 8, 2023
@riazey
Copy link

riazey commented Feb 10, 2023

Experienced this on RC1 on Win10 while importing a single PNG in a fresh project, was able to fix it thanks to above by deleting the files in .import associated with the one I tried to import :)

But then I got the error again right away xD So I have to keep deleting the .import files

@YuriSizov
Copy link
Contributor

YuriSizov commented Feb 11, 2023

To quote @akien-mga

According to #73125 this can crash (not surprising, a freeze/deadlock typically ends with a crash eventually due to stack overflow), and is a regression since beta 17.

Probably caused by #72031.

I can confirm the issue. What's interesting is that dragging from desktop doesn't trigger any error for me. Only from the file explorer.

So, I think I know what's up. It doesn't happen when dragging from desktop, but does happen when dragging from the file explorer, i.e. from another app. I think the issue is that upon regaining focus two attempts to rescan happen. One from the drag'n'drop, and another from regaining focus. Which causes a hang, which eventually causes a crash. And which also doesn't actually prevent the texture from reimporting (visible upon a restart).

Edit: To clarify, drag'n'drop from the file explorer also works as long as it is in the background, and Godot's window is in focus. If you focus the file explorer window instead, and the drag'n'drop, it will trigger rescan two times, and hang.

Edit 2: This is related to threading as well. Update goes through these lines, crashing during the _update_scan_actions() call:

if (use_threads) {
if (scanning_changes) {
if (scanning_changes_done) {
scanning_changes = false;
set_process(false);
thread_sources.wait_to_finish();
bool changed = _update_scan_actions();
_update_pending_script_classes();

@akien-mga akien-mga pinned this issue Feb 12, 2023
reduz added a commit to reduz/godot that referenced this issue Feb 13, 2023
Prevents recursion when importing files due to the ill nature of EditorProgress.
The progress dialog will have to be entirely rewritten after 4.0 is out due to it being a constant source of bugs.
In the meantime, this fixes the problem.

Fixes godotengine#53871. Supersedes godotengine#73159.
@github-project-automation github-project-automation bot moved this from Todo to Done in 4.x Priority Issues Feb 13, 2023
@akien-mga akien-mga unpinned this issue Feb 22, 2023
JeffVenancius pushed a commit to JeffVenancius/godot that referenced this issue Mar 3, 2023
Prevents recursion when importing files due to the ill nature of EditorProgress.
The progress dialog will have to be entirely rewritten after 4.0 is out due to it being a constant source of bugs.
In the meantime, this fixes the problem.

Fixes godotengine#53871. Supersedes godotengine#73159.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment