-
Notifications
You must be signed in to change notification settings - Fork 308
Fix stretched/misplaced logo on startup & race conditions #1286
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
base: master
Are you sure you want to change the base?
Changes from all commits
6e0a586
6b24662
6d0f67d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1730,11 +1730,23 @@ void EditorFileSystem::_notification(int p_what) { | |
| case NOTIFICATION_EXIT_TREE: { | ||
| Thread &active_thread = thread.is_started() ? thread : thread_sources; | ||
| if (use_threads && active_thread.is_started()) { | ||
| const uint64_t TIMEOUT_USEC = 3000000; // 3 seconds | ||
| uint64_t start = OS::get_singleton()->get_ticks_usec(); | ||
| bool timed_out = false; | ||
| while (scanning) { | ||
| if (OS::get_singleton()->get_ticks_usec() - start > TIMEOUT_USEC) { | ||
| WARN_PRINT("EditorFileSystem: Timed out waiting for scan thread. Thread will be detached."); | ||
| timed_out = true; | ||
| break; | ||
| } | ||
| OS::get_singleton()->delay_usec(1000); | ||
| } | ||
| active_thread.wait_to_finish(); | ||
| WARN_PRINT("Scan thread aborted..."); | ||
| if (!timed_out) { | ||
| active_thread.wait_to_finish(); | ||
| } else { | ||
| WARN_PRINT("Scan thread aborted..."); | ||
| } | ||
|
Comment on lines
1736
to
+1748
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🔴 Critical | 🏗️ Heavy lift Don’t free filesystem state while the scan thread may still be running. On timeout this skips Also applies to: 1753-1760 🤖 Prompt for AI Agents |
||
|
|
||
| set_process(false); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Timeout fallback undermines the shutdown-safety guarantee it's paired with.
Breaking out of the wait loop on timeout still lets the function return normally and move to the next runlevel (and eventually back to
Main::cleanup(), which now deletes the main loop/SceneTree right after this call). If a worker task is genuinely stuck or just slow (>5s, or >10s across both phases), a thread can still be executing with stale scene/script references at the moment the SceneTree is deleted andScriptServer::finish_languages()runs — the exact use-after-free/deadlock scenario the new call ordering inMain::cleanup()is meant to avoid. The timeout converts a hang into a (rarer but still possible) crash during shutdown.Consider making the timeout path fail loud rather than silently proceed — e.g., skip forcing
RUNLEVEL_EXIT_LANGUAGES/subsequent shutdown steps when the previous phase timed out, or escalate (abort/force-terminate stuck threads) instead of falling through to normal teardown.🤖 Prompt for AI Agents