From 4532cbe006059c90b2787ce0d18c7c8809fe65ea Mon Sep 17 00:00:00 2001 From: Edgar J San Martin <29460583+ej-sanmartin@users.noreply.github.com> Date: Sun, 28 Dec 2025 01:11:15 -0500 Subject: [PATCH] Disable threaded imports when WorkerThreadPool has insufficient threads. --- editor/file_system/editor_file_system.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/editor/file_system/editor_file_system.cpp b/editor/file_system/editor_file_system.cpp index a286f0956f..94d64c29c9 100644 --- a/editor/file_system/editor_file_system.cpp +++ b/editor/file_system/editor_file_system.cpp @@ -3287,6 +3287,15 @@ void EditorFileSystem::reimport_files(const Vector &p_files) { #ifdef THREADS_ENABLED bool use_multiple_threads = GLOBAL_GET("editor/import/use_multiple_threads"); +#ifdef WEB_ENABLED + // The Web platform may have threading compiled in, but with only 1 available thread (the main thread). + // Using threaded imports with a single thread causes a deadlock as the main thread waits in a busy-loop + // while the import tasks can't execute. Disable threaded imports when insufficient threads are available. + // See GH-112072 for details. + if (WorkerThreadPool::get_singleton()->get_thread_count() <= 1) { + use_multiple_threads = false; + } +#endif #else bool use_multiple_threads = false; #endif