From f959acd680b7f9bf12c26a2d63a2cc0e3c24601b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 17 Oct 2026 13:51:56 +0200 Subject: [PATCH] Log the waits on exit So a log from a process that never exits shows which step it hung in. Co-Authored-By: Claude Opus 5.5 (1M context) --- UI/NativeApp.cpp | 5 +++++ Windows/main.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 806051b3fb..dbd2bc5906 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -1862,11 +1862,15 @@ void NativeShutdown() { g_i18nrepo.LogMissingKeys(); + // Each of these waits for a thread. Log them, so a hang on exit shows which one it was. + INFO_LOG(Log::System, "Shutting down the web server"); ShutdownWebServer(); + INFO_LOG(Log::System, "Shutting down UPnP"); __UPnPShutdown(); // A request finishing while globals are destroyed at exit touches g_OSD, which may be gone by then. + INFO_LOG(Log::System, "Cancelling downloads"); g_DownloadManager.CancelAll(); net::Shutdown(); @@ -1875,6 +1879,7 @@ void NativeShutdown() { ShaderTranslationShutdown(); + INFO_LOG(Log::System, "Stopping the thread pool"); // Avoid shutting this down when restarting core. g_logManager.Shutdown(); g_threadManager.Teardown(); diff --git a/Windows/main.cpp b/Windows/main.cpp index 985217108a..6ddb0441d3 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -1367,7 +1367,9 @@ int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLin // Already stopped? _dbg_assert_(mainThread.joinable()); + INFO_LOG(Log::System, "Waiting for the main thread to exit"); mainThread.join(); + INFO_LOG(Log::System, "Main thread exited"); // The debugger windows reach into core state as they go away (CtrlDisAsmView touches // g_disassemblyManager, for example), so tear them down while the core is still around.