Fix potential service deadlock when plugin returns an error from OnVmStarted by OneBlue · Pull Request #13569 · microsoft/WSL

00 00000083`892fec38 00007ffc`3f49dd6e     ntdll!ZwWaitForAlertByThreadId+0x14  
01 00000083`892fec40 00007ffc`3cb0f518     ntdll!RtlSleepConditionVariableSRW+0x1de  
02 00000083`892fece0 00007ff6`78a8e807     KERNELBASE!SleepConditionVariableSRW+0x38  
03 00000083`892fed20 00007ff6`78a8e793     wslservice!_Primitive_wait_for+0x47  
04 00000083`892fed70 00007ff6`78a8ead7     wslservice!_Primitive_wait+0x23  
05 00000083`892feda0 00007ff6`786a03c4     wslservice!_Cnd_wait+0x27  
06 00000083`892fedd0 00007ff6`78694051     wslservice!std::condition_variable::wait+0x44  
07 00000083`892fee10 00007ff6`78639759     wslservice!std::recursive_timed_mutex::lock+0xf1  
08 00000083`892feea0 00007ff6`785ae722     wslservice!std::lock_guard<std::recursive_timed_mutex>::lock_guard<std::recursive_timed_mutex>+0x29  
09 00000083`892feed0 00007ff6`785bb0db     wslservice!LxssUserSessionImpl::TerminateByClientId+0x52  
0a 00000083`892fef30 00007ff6`786239e2     wslservice!LxssUserSessionImpl::s_VmTerminated+0x1b  
0b 00000083`892fef70 00007ff6`785dff18     wslservice!std::invoke<void (__cdecl*&)(LxssUserSessionImpl *,_GUID const &),LxssUserSessionImpl * &,_GUID>+0x32  
0c 00000083`892fefb0 00007ff6`785e0103     wslservice!std::_Invoker_ret<std::_Unforced>::_Call<void (__cdecl*&)(LxssUserSessionImpl *,_GUID const &),LxssUserSessionImpl * &,_GUID>+0x28  
0d 00000083`892fefe0 00007ff6`785d6a75     wslservice!std::_Call_binder<std::_Unforced,0,1,void (__cdecl*)(LxssUserSessionImpl *,_GUID const &),std::tuple<LxssUserSessionImpl *,std::_Ph<1> >,std::tuple<_GUID &&> >+0x63  
0e 00000083`892ff020 00007ff6`78623c1e     wslservice!std::_Binder<std::_Unforced,void (__cdecl&)(LxssUserSessionImpl *,_GUID const &),LxssUserSessionImpl *,std::_Ph<1> const &>::operator()<_GUID>+0xa5  
0f 00000083`892ff080 00007ff6`78667f15     wslservice!std::invoke<std::_Binder<std::_Unforced,void (__cdecl&)(LxssUserSessionImpl *,_GUID const &),LxssUserSessionImpl *,std::_Ph<1> const &> &,_GUID>+0x1e  
10 00000083`892ff0b0 00007ff6`78830674     wslservice!std::_Func_impl_no_alloc<std::_Binder<std::_Unforced,void (__cdecl&)(LxssUserSessionImpl *,_GUID const &),LxssUserSessionImpl *,std::_Ph<1> const &>,void,_GUID>::_Do_call+0x25  
11 00000083`892ff0e0 00007ff6`7886af2a     wslservice!std::_Func_class<void,_GUID>::operator()+0x54  
12 00000083`892ff120 00007ff6`7886c7dd     wslservice!WslCoreVm::OnExit+0x1da  
13 00000083`892ff220 00007ffc`2eef7fb4     wslservice!WslCoreVm::s_OnExit+0x6d  
14 00000083`892ff270 00007ffc`2eef6bde     computecore!HcsClient::OperationTracker::InvokeOrQueueEvent+0x26c  
15 00000083`892ff4d0 00007ffc`2eef824d     computecore!<lambda_a99cc396030748f23bd3ed4032603b57>::operator()+0x772  
16 00000083`892ff600 00007ffc`2eef44fc     computecore!HcsClient::OperationTracker::OnHcsNotification+0xb9  
17 00000083`892ff7f0 00007ffc`2eedbf8e     computecore!<lambda_bc13fa22e3274a4fea1a03d75833842b>::<lambda_invoker_cdecl>+0x2c  
18 00000083`892ff820 00007ffc`2eedc7ff     computecore!ComputeService::Client::NotificationCallbacks::OnNotificationPending+0x10a  
19 00000083`892ff8c0 00007ffc`3f440c0d     computecore!ComputeService::Client::NotificationCallbacks::WaitCallback+0x2f  
1a 00000083`892ff930 00007ffc`3f43be4e     ntdll!TppExecuteWaitCallback+0x4cd  
1b 00000083`892ffa50 00007ffc`3f47e4d0     ntdll!TppDirectExecuteCallback+0xee  
1c 00000083`892ffab0 00007ffc`3e11e8d7     ntdll!TppWorkerThread+0x820  
1d 00000083`892ffe10 00007ffc`3f408d9c     KERNEL32!BaseThreadInitThunk+0x17  
1e 00000083`892ffe40 00000000`00000000     ntdll!RtlUserThreadStart+0x2c  
07 00000083`88bf7450 00007ffc`2eec8684     computecore!HcsClient::CloseComputeSystem+0x24  
08 00000083`88bf7480 00007ff6`788e9093     computecore!HcsCloseComputeSystem+0x64  
09 00000083`88bf7610 00007ff6`788edce0     wslservice!wil::details::close_invoke_helper<1,void (__cdecl*)(HCS_SYSTEM__ *),&HcsCloseComputeSystem,HCS_SYSTEM__ *>::close_reset+0x43  
0a 00000083`88bf7670 00007ff6`7885b916     wslservice!wil::details::unique_storage<wil::details::resource_policy<HCS_SYSTEM__ *,void (__cdecl*)(HCS_SYSTEM__ *),&HcsCloseComputeSystem,wistd::integral_constant<unsigned __int64,0>,HCS_SYSTEM__ *,HCS_SYSTEM__ *,0,std::nullptr_t> >::reset+0x30  
0b 00000083`88bf76a0 00007ff6`78655dd8     wslservice!WslCoreVm::~WslCoreVm+0x656  
0c 00000083`88bf7aa0 00007ff6`78653b20     wslservice!WslCoreVm::`scalar deleting destructor'+0x18
0d 00000083`88bf7ad0 00007ff6`786995ef     wslservice!std::default_delete<WslCoreVm>::operator()+0x30  
0e 00000083`88bf7b10 00007ff6`785b96d4     wslservice!std::unique_ptr<WslCoreVm,std::default_delete<WslCoreVm> >::reset+0x4f  
0f 00000083`88bf7b50 00007ff6`78c13464     wslservice!LxssUserSessionImpl::_VmTerminate+0xd4  
10 00000083`88bf7bc0 00007ff6`78af7390     wslservice!`LxssUserSessionImpl::_CreateVm'::`1'::catch$10+0x77  
11 00000083`88bf7c10 00007ff6`78ade08e     wslservice!_CallSettingFrame_LookupContinuationIndex+0x20  
12 00000083`88bf7c40 00007ffc`3f522cc6     wslservice!__FrameHandler4::CxxCallCatchBlock+0x1de  
13 00000083`88bf7d10 00007ff6`785b3bb5     ntdll!RcFrameConsolidation+0x6  
14 00000083`88bfba50 00007ff6`785b08eb     wslservice!LxssUserSessionImpl::_CreateVm+0x7c5  
15 00000083`88bfc1a0 00007ff6`785a418d     wslservice!LxssUserSessionImpl::_CreateInstance+0xb2b  
16 00000083`88bfd210 00007ff6`7859f2b8     wslservice!LxssUserSessionImpl::CreateInstance+0x2d