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

Deadlock when exiting and using Multithreaded renderer #96931

Closed
clayjohn opened this issue Sep 12, 2024 · 0 comments · Fixed by #96959
Closed

Deadlock when exiting and using Multithreaded renderer #96931

clayjohn opened this issue Sep 12, 2024 · 0 comments · Fixed by #96959

Comments

@clayjohn
Copy link
Member

Tested versions

  • Master (anything after 2d1dd41)
  • 4.4 dev2 (does not reproduce)

System information

Godot v4.4.dev (2d1dd41) - Pop!_OS 22.04 LTS - X11 - Vulkan (Forward+) - integrated Intel(R) Xe Graphics (TGL GT2) - 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz (8 Threads)

Issue description

The WorkerThreadPool deadlocks in the main::cleanup() function during shutdown.

This is a regression and I bisected it to 2d1dd41

#96760 makes it so the WTP is finalized before the servers have a chance to shut down. When using the MT thread model, the servers yield to the WTP until a command is pushed to them.

During finalizing, the WTP waits for all threads to finish, this locks the main thread. However, the command to finalize the rendering thread happens after the WTP finalizes. So the main thread gets stuck indefinitely.

This bug also impacts any other system that creates a long running thread through the WTP and relies on yielding.

Steps to reproduce

  1. Enabled the Multi thread rendering model
  2. Run the project
  3. Try to close the project

Minimal reproduction project (MRP)

mt-deadlock.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Immediate Blocker
Development

Successfully merging a pull request may close this issue.

2 participants