common: Intentionally leak logger instance to fix hanging on Windows #22273
common: Intentionally leak logger instance to fix hanging on Windows #22273rillomas wants to merge 10 commits intoggml-org:masterfrom
Conversation
|
Does not seem to work - the tests are failing |
|
Let me have a look again. |
Using std::vector will cause g_col to be released before the logger thread exits, causing the logger thread to touch freed memory causing a crash
|
I've fixed the crashing on Linux. It seems like |
|
Seems like even if we skip the logger's destruction, calling
|
Overview
Added workaround for #22142. There are three points in this PR:
~common_log()called at DLL teardown phase was causing hanging on Windows. DLL teardown phase seems to be a fragile timing to do system calls like mutex lock, cond notify, thread join, etc. which did not provide sane results. We are working around this by intentionally leaking the logger instance to skip cleanup.common_log_freeattest-logcommon_log_flush. This seemed like a timing issue where the OS is running DLL teardown while the runtime tries to start the logger thread asynchronously (which was started bycommon_log_flush). We added an explicit cleanup in the end of the unit test to avoid this.Requirements