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

GodotSharp deadlock in RemoveScriptBridge / CreateScriptBridgeForType on scene transition #87127

Closed
DavidVonDerau opened this issue Jan 12, 2024 · 3 comments

Comments

@DavidVonDerau
Copy link

Tested versions

  • Occurs in: v4.2.mono.official [46dc277]

System information

Godot v4.2.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3667) - AMD Ryzen 7 5800X 8-Core Processor (16 Threads)

Issue description

I believe this is a race condition between GodotObject Dispose and load_threaded_request but I'm not certain.

Very rarely on a scene transition where a new scene with C# scripts is loaded in the background using load_threaded_request, while simultaneously 1 or more Nodes with C# scripts has been QueueFree()'d from the SceneTree, the project will deadlock.

A GodotObject calling Dispose (one of the nodes that had QueueFree called) will block on removing the attached C# script, while the new scene that is being loaded in the background will block on creating a new C# script.

The call stack for all threads looks like:
image

Steps to reproduce

The following is a hypothesis because I'm having trouble narrowing this down.
I'm mostly working off the stack trace above and looking at what my code is doing during the scene transition, but it's possible that the actual issue is caused by something entirely unrelated.

  1. Create a "scene container" master scene.
  2. Create a function to transition scenes -- QueueFree() the current scene node, load_threaded_request the new scene, and then Instantiate + AddChild when the threaded request is complete.
  3. Using two scenes that both have Nodes with C# scripts attached, transition repeatedly between the scenes.
  4. Rarely the entire application will permanently deadlock during the transition on the stack trace shown above.

Minimal reproduction project (MRP)

N/A (I haven't figured out the MRP steps yet)

@d6e
Copy link

d6e commented Mar 21, 2024

This might be the same issue as this #87405

which apparently should be fixed in Godot 4.2.2: #87669

@akien-mga
Copy link
Member

@DavidVonDerau Could you confirm whether 4.2.2-rc2 fixes the issue?

@AThousandShips
Copy link
Member

Closing due to lack of response, if you provide the requested information this can be reopened

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
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

5 participants