<div dir="ltr">It looks like the issue is that we're trying to acquire the mutex during process shutdown. Specifically, here's a partial callstack:<div><br></div><div><div> <span class="" style="white-space:pre"> </span>libclang.dll!mtx_do_lock(_Mtx_internal_imp_t * * mtx=0x01b118e4, const xtime * target=0x00000000) Line 67<span class="" style="white-space:pre"> </span>C++</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!_Mtx_lock(_Mtx_internal_imp_t * * mtx=0x01b118e4) Line 153<span class="" style="white-space:pre"> </span>C++</div><div> <span class="" style="white-space:pre"> </span>libclang.dll!std::_Mtx_lockX(_Mtx_internal_imp_t * * _Mtx=0x01b118e4) Line 68<span class="" style="white-space:pre"> </span>C++</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!std::_Mutex_base::lock() Line 41<span class="" style="white-space:pre"> </span>C++</div><div> <span class="" style="white-space:pre"> </span>libclang.dll!llvm::sys::Mutex<0,1>::acquire() Line 94<span class="" style="white-space:pre"> </span>C++</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!llvm::MutexGuard::MutexGuard(llvm::sys::MutexBase & m={...}) Line 33<span class="" style="white-space:pre"> </span>C++</div><div>><span class="" style="white-space:pre"> </span>libclang.dll!cleanupOnDiskMapAtExit() Line 124<span class="" style="white-space:pre"> </span>C++</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!doexit(int code=0, int quick=0, int retcaller=1) Line 628<span class="" style="white-space:pre"> </span>C</div><div> <span class="" style="white-space:pre"> </span>libclang.dll!_cexit() Line 448<span class="" style="white-space:pre"> </span>C</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!_CRT_INIT(void * hDllHandle=0x0f360000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 169<span class="" style="white-space:pre"> </span>C</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!__DllMainCRTStartup(void * hDllHandle=0x0f360000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 399<span class="" style="white-space:pre"> </span>C</div>
<div> <span class="" style="white-space:pre"> </span>libclang.dll!_DllMainCRTStartup(void * hDllHandle=0x0f360000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 340<span class="" style="white-space:pre"> </span>C</div>
<div> <span class="" style="white-space:pre"> </span>ntdll.dll!_LdrxCallInitRoutine@16()<span class="" style="white-space:pre"> </span>Unknown</div><div> <span class="" style="white-space:pre"> </span>ntdll.dll!LdrpCallInitRoutine()<span class="" style="white-space:pre"> </span>Unknown</div>
<div> <span class="" style="white-space:pre"> </span>ntdll.dll!LdrShutdownProcess()<span class="" style="white-space:pre"> </span>Unknown</div><div> <span class="" style="white-space:pre"> </span>ntdll.dll!RtlExitUserProcess()<span class="" style="white-space:pre"> </span>Unknown</div>
<div><br></div><div><br></div><div>And this is the mutex that is hung. If I go debug inside the CRT, the owning threadid is set to -1, so I'm not sure. Maybe something's been uninitialized by this point. I thought of using ManagedStatic<> to better control the uninitialization of the mutex, but I don't think that really solves the problem. The issue is that we're even relying on a mutex at all during CRT shutdown. </div>
<div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, May 29, 2014 at 2:44 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Thu, May 29, 2014 at 5:41 PM, Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br>
> What command are you using to run the tests? I'm still a new contributor,<br>
> and am not familiar with how to do everything, but I run ninja check-all and<br>
> while it doesn't seem to be finishing, I am not getting any output. How can<br>
> I get a command line of a single test that I can easily run independently on<br>
> the command line to reproduce a deadlock so I can look into this further?<br>
<br>
</div>I was running my tests from within MSVC by building the check-clang<br>
project; output pipes automatically into the output window as the<br>
tests run. You can use python and llvm-lit to run specific tests from<br>
the command line. Eg) python.exe ./bin/llvm-lit.py -v<br>
../tools/clang/test/Sema/warn-thread-safety-analysis.c<br>
<br>
HTH!<br>
<span class="HOEnZb"><font color="#888888"><br>
~Aaron<br>
</font></span></blockquote></div><br></div>