dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.97k stars 4.66k forks source link

Call to gc_heap::create_bgc_thread hanging #96984

Closed Jordan-Osborn closed 6 months ago

Jordan-Osborn commented 8 months ago

DotNet Runtime: 6.0.21 GC mode: Concurrent workstation vertarget:

Product: WinNt, suite: SingleUserTS
Edition build lab: 19041.1.amd64fre.vb_release.191206-1406
Debug session time: Fri Jan  5 09:31:06.000 2024 (UTC + 0:00)
System Uptime: 5 days 9:58:21.986
Process Uptime: 0 days 4:13:58.000
  Kernel time: 0 days 0:00:03.000
  User time: 0 days 0:01:44.000

We've started running into sporadic infinite hangs during the initialisation phase of our application. We've taken several dumps spaced apart in time and it seems that each of them are stuck executing GC logic (the stacks I've attached below are the same in each of them).

The events I've been able to trace are (please correct me if I've missed something)

  1. The allocating thread triggers a GC.
  2. The call out to the GC suspends all other managed threads (the managed threads have calls to GCHeap::WaitUntilGCComplete in their stack).
  3. The allocating thread progresses to the point where it makes a check to ensure the BGC (background gc) thread has been started (it hasn’t).
  4. It then attempts to start the BGC thread waiting for it to initialise with an infinite timeout CreateSuspendableThread
  5. The BGC thread is started but is stuck inside some calls to the loader that are made as a part of thread initialization (ThreadStartedEvent is therefore never set).
  6. All managed threads are then stuck until the BGC thread initialises.
  7. Infinite hang

Any ideas on what could cause this/ things to investigate? We're looking at upgrading to 6.0.26 but not at a major version upgrade at this time. I'm happy to provide more information from the dump if needed but unfortunately I can't share the file in full.

0:084> kp
 # Child-SP          RetAddr               Call Site
00 00000049`099f6938 00007ff9`b30930ce     ntdll!NtWaitForSingleObject+0x14
01 00000049`099f6940 00007ff9`52215f2f     KERNELBASE!WaitForSingleObjectEx+0x8e
02 00000049`099f69e0 00007ff9`422752e0     mso!OfficeSpace::Root::FCanAskControlUsers+0x7f
03 (Inline Function) --------`--------     coreclr!CLREventWaitHelper2(void)+0x6 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 372] 
04 00000049`099f6a30 00007ff9`4238e2fb     coreclr!CLREventWaitHelper(void * handle = 0x00000000`00000000, unsigned long dwMilliseconds = 1, int alertable = 0n161442832)+0x20 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 397] 
05 (Inline Function) --------`--------     coreclr!CLREventBase::WaitEx(void)+0x10 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 466] 
06 (Inline Function) --------`--------     coreclr!CLREventBase::Wait(void)+0x10 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 412] 
07 00000049`099f6a90 00007ff9`422daa1f     coreclr!`anonymous namespace'::CreateSuspendableThread(<function> * threadStart = <Value unavailable error>, void * argument = 0x00000000`00000000, wchar_t * name = 0x00000049`099f6c10 ".NET BGC")+0x10f [D:\a\_work\1\s\src\coreclr\vm\gcenv.ee.cpp @ 1426] 
08 00000049`099f6b60 00007ff9`42393b38     coreclr!GCToEEInterface::CreateThread(<function> * threadStart = 0x00007ff9`4238c860, void * arg = 0x00000000`00000000, bool is_suspendable = true, char * name = 0x00000000`00000001 "--- memory read error at address 0x00000000`00000001 ---")+0x167 [D:\a\_work\1\s\src\coreclr\vm\gcenv.ee.cpp @ 1513] 
09 (Inline Function) --------`--------     coreclr!WKS::gc_heap::create_bgc_thread(void)+0x18 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 33769] 
0a 00000049`099f6d50 00007ff9`422dcb49     coreclr!WKS::gc_heap::prepare_bgc_thread(void)+0x4c [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 33744] 
0b 00000049`099f6d80 00007ff9`422dd771     coreclr!WKS::gc_heap::garbage_collect(int n = 0n0)+0x2e1 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 21665] 
0c 00000049`099f6dd0 00007ff9`423864ab     coreclr!WKS::GCHeap::GarbageCollectGeneration(unsigned int gen = 0, gc_reason reason = reason_alloc_loh (0n4))+0x145 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 44720] 
0d 00000049`099f6e20 00007ff9`423c91f5     coreclr!WKS::gc_heap::trigger_gc_for_alloc(int gen_number = <Value unavailable error>, gc_reason gr = <Value unavailable error>, struct WKS::GCDebugSpinLock * msl = 0x00007ff9`426d8dfc, bool loh_p = true)+0x2b [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 16849] 
0e 00000049`099f6e50 00007ff9`4236f7e5     coreclr!WKS::gc_heap::try_allocate_more_space+0x599e9 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 16980] 
0f 00000049`099f6eb0 00007ff9`4236f6fa     coreclr!WKS::gc_heap::allocate_more_space(struct alloc_context * acontext = 0x00000049`099f6f00, unsigned int64 size = 0x1388038, unsigned int flags = 0x20, int alloc_generation_number = 0n3)+0x31 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 17450] 
10 00000049`099f6ee0 00007ff9`422e54cd     coreclr!WKS::gc_heap::allocate_uoh_object(unsigned int64 jsize = <Value unavailable error>, unsigned int flags = <Value unavailable error>, int gen_number = <Value unavailable error>, int64 * alloc_bytes = 0x0000016c`310cc000)+0x6a [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 39369] 
11 00000049`099f6f50 00007ff9`422fd136     coreclr!WKS::GCHeap::Alloc(struct gc_alloc_context * context = 0x0000016c`310cbfe8, unsigned int64 size = 0x1388018, unsigned int flags = 0x20)+0xcd [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 43653] 
12 00000049`099f6f80 00007ff9`4226a3d6     coreclr!Alloc(unsigned int64 size = 0x1388018, GC_ALLOC_FLAGS flags = <Value unavailable error>)+0x96 [D:\a\_work\1\s\src\coreclr\vm\gchelpers.cpp @ 239] 
13 (Inline Function) --------`--------     coreclr!AllocateSzArray(GC_ALLOC_FLAGS flags = GC_ALLOC_LARGE_OBJECT_HEAP (0n32))+0xcc [D:\a\_work\1\s\src\coreclr\vm\gchelpers.cpp @ 426] 
14 00000049`099f6fd0 00007ff8`e80afe06     coreclr!JIT_NewArr1(struct CORINFO_CLASS_STRUCT_ * arrayMT = 0x00007ff8`e28d4b28, int64 size = 0n20480000)+0x246 [D:\a\_work\1\s\src\coreclr\vm\jithelpers.cpp @ 2658] 
...

.NET BGC thread

0:097> kp
 # Child-SP          RetAddr               Call Site
00 00000049`08eff488 00007ff9`b57aeb32     ntdll!NtWaitForSingleObject+0x14
01 00000049`08eff490 00007ff9`b57677c3     ntdll!LdrpDrainWorkQueue+0x15e
02 00000049`08eff4d0 00007ff9`b57c5064     ntdll!LdrpInitializeThread+0x8b
03 00000049`08eff5b0 00007ff9`b57c4c43     ntdll!LdrpInitialize+0x408
04 00000049`08eff650 00007ff9`b57c4bee     ntdll!LdrpInitialize+0x3b
05 00000049`08eff680 00000000`00000000     ntdll!LdrInitializeThunk+0xe
ghost commented 8 months ago

Tagging subscribers to this area: @dotnet/gc See info in area-owners.md if you want to be subscribed.

Issue Details
DotNet Runtime: 6.0.21 GC mode: Concurrent workstation vertarget: ```Windows 10 Version 19044 MP (24 procs) Free x64 Product: WinNt, suite: SingleUserTS Edition build lab: 19041.1.amd64fre.vb_release.191206-1406 Debug session time: Fri Jan 5 09:31:06.000 2024 (UTC + 0:00) System Uptime: 5 days 9:58:21.986 Process Uptime: 0 days 4:13:58.000 Kernel time: 0 days 0:00:03.000 User time: 0 days 0:01:44.000 ``` We've started running into sporadic infinite hangs during the initialisation phase of our application. We've taken several dumps spaced apart in time and it seems that each of them are stuck executing GC logic (the stacks I've attached below are the same in each of them). The events I've been able to trace are (please correct me if I've missed something) 1. The allocating thread triggers a GC. 1. The call out to the GC suspends all other managed threads (the managed threads have calls to GCHeap::WaitUntilGCComplete in their stack). 1. The allocating thread progresses to the point where it makes a check to ensure the BGC (background gc) thread has been started (it hasn’t). 1. It then attempts to start the BGC thread waiting for it to initialise with an infinite timeout [CreateSuspendableThread](https://github.com/dotnet/runtime/blob/v6.0.21/src/coreclr/vm/gcenv.ee.cpp#L1425) 1. The BGC thread is started but is stuck inside some calls to the loader that are made as a part of thread initialization (ThreadStartedEvent is therefore never set). 1. All managed threads are then stuck until the BGC thread initialises. 1. Infinite hang Any ideas on what could cause this/ things to investigate? We're looking at upgrading to 6.0.26 but not at a major version upgrade at this time. I'm happy to provide more information from the dump if needed but unfortunately I can't share the file in full. ``` 0:084> kp # Child-SP RetAddr Call Site 00 00000049`099f6938 00007ff9`b30930ce ntdll!NtWaitForSingleObject+0x14 01 00000049`099f6940 00007ff9`52215f2f KERNELBASE!WaitForSingleObjectEx+0x8e 02 00000049`099f69e0 00007ff9`422752e0 mso!OfficeSpace::Root::FCanAskControlUsers+0x7f 03 (Inline Function) --------`-------- coreclr!CLREventWaitHelper2(void)+0x6 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 372] 04 00000049`099f6a30 00007ff9`4238e2fb coreclr!CLREventWaitHelper(void * handle = 0x00000000`00000000, unsigned long dwMilliseconds = 1, int alertable = 0n161442832)+0x20 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 397] 05 (Inline Function) --------`-------- coreclr!CLREventBase::WaitEx(void)+0x10 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 466] 06 (Inline Function) --------`-------- coreclr!CLREventBase::Wait(void)+0x10 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 412] 07 00000049`099f6a90 00007ff9`422daa1f coreclr!`anonymous namespace'::CreateSuspendableThread( * threadStart = , void * argument = 0x00000000`00000000, wchar_t * name = 0x00000049`099f6c10 ".NET BGC")+0x10f [D:\a\_work\1\s\src\coreclr\vm\gcenv.ee.cpp @ 1426] 08 00000049`099f6b60 00007ff9`42393b38 coreclr!GCToEEInterface::CreateThread( * threadStart = 0x00007ff9`4238c860, void * arg = 0x00000000`00000000, bool is_suspendable = true, char * name = 0x00000000`00000001 "--- memory read error at address 0x00000000`00000001 ---")+0x167 [D:\a\_work\1\s\src\coreclr\vm\gcenv.ee.cpp @ 1513] 09 (Inline Function) --------`-------- coreclr!WKS::gc_heap::create_bgc_thread(void)+0x18 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 33769] 0a 00000049`099f6d50 00007ff9`422dcb49 coreclr!WKS::gc_heap::prepare_bgc_thread(void)+0x4c [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 33744] 0b 00000049`099f6d80 00007ff9`422dd771 coreclr!WKS::gc_heap::garbage_collect(int n = 0n0)+0x2e1 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 21665] 0c 00000049`099f6dd0 00007ff9`423864ab coreclr!WKS::GCHeap::GarbageCollectGeneration(unsigned int gen = 0, gc_reason reason = reason_alloc_loh (0n4))+0x145 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 44720] 0d 00000049`099f6e20 00007ff9`423c91f5 coreclr!WKS::gc_heap::trigger_gc_for_alloc(int gen_number = , gc_reason gr = , struct WKS::GCDebugSpinLock * msl = 0x00007ff9`426d8dfc, bool loh_p = true)+0x2b [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 16849] 0e 00000049`099f6e50 00007ff9`4236f7e5 coreclr!WKS::gc_heap::try_allocate_more_space+0x599e9 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 16980] 0f 00000049`099f6eb0 00007ff9`4236f6fa coreclr!WKS::gc_heap::allocate_more_space(struct alloc_context * acontext = 0x00000049`099f6f00, unsigned int64 size = 0x1388038, unsigned int flags = 0x20, int alloc_generation_number = 0n3)+0x31 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 17450] 10 00000049`099f6ee0 00007ff9`422e54cd coreclr!WKS::gc_heap::allocate_uoh_object(unsigned int64 jsize = , unsigned int flags = , int gen_number = , int64 * alloc_bytes = 0x0000016c`310cc000)+0x6a [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 39369] 11 00000049`099f6f50 00007ff9`422fd136 coreclr!WKS::GCHeap::Alloc(struct gc_alloc_context * context = 0x0000016c`310cbfe8, unsigned int64 size = 0x1388018, unsigned int flags = 0x20)+0xcd [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 43653] 12 00000049`099f6f80 00007ff9`4226a3d6 coreclr!Alloc(unsigned int64 size = 0x1388018, GC_ALLOC_FLAGS flags = )+0x96 [D:\a\_work\1\s\src\coreclr\vm\gchelpers.cpp @ 239] 13 (Inline Function) --------`-------- coreclr!AllocateSzArray(GC_ALLOC_FLAGS flags = GC_ALLOC_LARGE_OBJECT_HEAP (0n32))+0xcc [D:\a\_work\1\s\src\coreclr\vm\gchelpers.cpp @ 426] 14 00000049`099f6fd0 00007ff8`e80afe06 coreclr!JIT_NewArr1(struct CORINFO_CLASS_STRUCT_ * arrayMT = 0x00007ff8`e28d4b28, int64 size = 0n20480000)+0x246 [D:\a\_work\1\s\src\coreclr\vm\jithelpers.cpp @ 2658] ... ``` .NET BGC thread ``` 0:097> kp # Child-SP RetAddr Call Site 00 00000049`08eff488 00007ff9`b57aeb32 ntdll!NtWaitForSingleObject+0x14 01 00000049`08eff490 00007ff9`b57677c3 ntdll!LdrpDrainWorkQueue+0x15e 02 00000049`08eff4d0 00007ff9`b57c5064 ntdll!LdrpInitializeThread+0x8b 03 00000049`08eff5b0 00007ff9`b57c4c43 ntdll!LdrpInitialize+0x408 04 00000049`08eff650 00007ff9`b57c4bee ntdll!LdrpInitialize+0x3b 05 00000049`08eff680 00000000`00000000 ntdll!LdrInitializeThunk+0xe ```
Author: Jordan-Osborn
Assignees: -
Labels: `area-GC-coreclr`, `untriaged`
Milestone: -
jkotas commented 8 months ago

mso!OfficeSpace::Root::FCanAskControlUsers+0x7f

Are you trying to use .NET inside an Office application? This frame suggests that you are .NET inside an Office application and that the Office application has detoured WaitForSingleObject API. It is likely the source of the hang. Is the Office app trying to display a dialog waiting for user to respond?

Note that .NET Core/5+ is not supported for VSTO Add-ins: https://learn.microsoft.com/en-us/visualstudio/vsto/create-vsto-add-ins-for-office-by-using-visual-studio

Jordan-Osborn commented 8 months ago

Thanks for the quick response. Yep this is an ExcelDNA addin using Net6.0. I've attached the stack of the main thread, it looks like it's also stuck inside FCanAskControlUsers. I can see most threads have that near the top of the stack, although some others have GetFCanCreateControlUsers, and others neither. As far as I know a dialog window didn't actually pop up, and from other EXCEL dumps I've seen the main thread stack ends up containing dialog window code if one is open which isn't the case here. Appreciate this is an unsupported use case, but is there anything you suggest we could look into/try?

0:000> k
 # Child-SP          RetAddr               Call Site
00 00000049`06b19338 00007ff9`b30930ce     ntdll!NtWaitForSingleObject+0x14
01 00000049`06b19340 00007ff9`52215fa2     KERNELBASE!WaitForSingleObjectEx+0x8e
02 00000049`06b193e0 00007ff9`422752e0     mso!OfficeSpace::Root::FCanAskControlUsers+0xf2
03 (Inline Function) --------`--------     coreclr!CLREventWaitHelper2+0x6 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 372] 
04 00000049`06b19430 00007ff9`42274e8e     coreclr!CLREventWaitHelper+0x20 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 397] 
05 (Inline Function) --------`--------     coreclr!CLREventBase::WaitEx+0x11 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 466] 
06 (Inline Function) --------`--------     coreclr!CLREventBase::Wait+0x11 [D:\a\_work\1\s\src\coreclr\vm\synch.cpp @ 412] 
07 (Inline Function) --------`--------     coreclr!GCEvent::Impl::Wait+0x18 [D:\a\_work\1\s\src\coreclr\vm\gcenv.os.cpp @ 1283] 
08 (Inline Function) --------`--------     coreclr!GCEvent::Wait+0x18 [D:\a\_work\1\s\src\coreclr\vm\gcenv.os.cpp @ 1361] 
09 00000049`06b19490 00007ff9`423195ed     coreclr!WKS::GCHeap::WaitUntilGCComplete+0x2e [D:\a\_work\1\s\src\coreclr\gc\gcee.cpp @ 287] 
0a 00000049`06b194c0 00007ff9`423749f0     coreclr!Thread::RareDisablePreemptiveGC+0x1c5 [D:\a\_work\1\s\src\coreclr\vm\threadsuspend.cpp @ 2172] 
0b 00000049`06b19540 00007ff9`42395f3f     coreclr!JIT_ReversePInvokeEnterRare2+0x18 [D:\a\_work\1\s\src\coreclr\vm\jithelpers.cpp @ 5462] 
0c 00000049`06b19570 00007ff8`e41e7afd     coreclr!JIT_ReversePInvokeEnterTrackTransitions+0xaf [D:\a\_work\1\s\src\coreclr\vm\jithelpers.cpp @ 5509] 
0d 00000049`06b195a0 00007ff9`b578ddf7     0x00007ff8`e41e7afd
0e 00000049`06b19600 00007ff9`b57d4927     ntdll!LdrpSendDllNotifications+0x87
0f 00000049`06b19660 00007ff9`b57fcf90     ntdll!LdrpCorProcessImports+0x33
10 00000049`06b19690 00007ff9`b57afd53     ntdll!LdrpMapDllWithSectionHandle+0x98500
11 00000049`06b196e0 00007ff9`b57afa80     ntdll!LdrpMapDllNtFileName+0x19f
12 00000049`06b197e0 00007ff9`b57aed1f     ntdll!LdrpMapDllFullPath+0xe0
13 00000049`06b19970 00007ff9`b576fb53     ntdll!LdrpProcessWork+0x123
14 00000049`06b199d0 00007ff9`b57673e4     ntdll!LdrpLoadDllInternal+0x13f
15 00000049`06b19a50 00007ff9`b5766af4     ntdll!LdrpLoadDll+0xa8
16 00000049`06b19c00 00007ff9`b30a56b2     ntdll!LdrLoadDll+0xe4
17 00000049`06b19cf0 00007ff9`b13c474e     KERNELBASE!LoadLibraryExW+0x162
18 00000049`06b19d60 00007ff9`422a735f     PGHook!PGHookFunction+0x1a15e
19 00000049`06b19e10 00007ff9`422a71ac     coreclr!LoadLibraryExWrapper+0x153 [D:\a\_work\1\s\src\coreclr\utilcode\longfilepathwrappers.cpp @ 68] 
1a (Inline Function) --------`--------     coreclr!CLRLoadLibraryExWorker+0x21 [D:\a\_work\1\s\src\coreclr\vm\util.cpp @ 1269] 
1b (Inline Function) --------`--------     coreclr!CLRLoadLibraryEx+0x21 [D:\a\_work\1\s\src\coreclr\vm\util.cpp @ 1288] 
1c 00000049`06b1a0e0 00007ff9`422a70ab     coreclr!LoadedImageLayout::LoadedImageLayout+0xa0 [D:\a\_work\1\s\src\coreclr\vm\peimagelayout.cpp @ 696] 
1d 00000049`06b1a130 00007ff9`422a7013     coreclr!PEImageLayout::Load+0x63 [D:\a\_work\1\s\src\coreclr\vm\peimagelayout.cpp @ 72] 
1e 00000049`06b1a170 00007ff9`422ab7de     coreclr!PEImage::CreateLayoutMapped+0x67 [D:\a\_work\1\s\src\coreclr\vm\peimage.cpp @ 1037] 
1f 00000049`06b1a1e0 00007ff9`422ab709     coreclr!PEImage::GetLayoutInternal+0x5e [D:\a\_work\1\s\src\coreclr\vm\peimage.cpp @ 1004] 
20 00000049`06b1a210 00007ff9`422a5b23     coreclr!PEImage::GetLayout+0x111 [D:\a\_work\1\s\src\coreclr\vm\peimage.cpp @ 939] 
21 00000049`06b1a290 00007ff9`422a5c60     coreclr!PEImage::CheckILFormat+0x37 [D:\a\_work\1\s\src\coreclr\vm\peimage.cpp @ 112] 
22 00000049`06b1a2d0 00007ff9`41b2b076     coreclr!AssemblyNative::LoadFromPath+0xb0 [D:\a\_work\1\s\src\coreclr\vm\assemblynative.cpp @ 243] 
23 00000049`06b1a3b0 00007ff8`e7aef322     System_Private_CoreLib+0x31b076
24 00000049`06b1a4a0 00007ff8`e6a6f333     0x00007ff8`e7aef322
25 00000049`06b1a510 00007ff8`e6a6f2f0     0x00007ff8`e6a6f333
26 00000049`06b1a540 00007ff9`4239af03     0x00007ff8`e6a6f2f0
27 00000049`06b1a570 00007ff9`422b8376     coreclr!CallDescrWorkerInternal+0x83
28 00000049`06b1a5b0 00007ff9`423a36eb     coreclr!MethodDescCallSite::CallTargetWorker+0x176 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp @ 551] 
29 (Inline Function) --------`--------     coreclr!MethodDescCallSite::Call_RetOBJECTREF+0x23 [D:\a\_work\1\s\src\coreclr\vm\callhelpers.h @ 461] 
2a 00000049`06b1a6e0 00007ff9`423ab69c     coreclr!RuntimeInvokeHostAssemblyResolver+0x1eb [D:\a\_work\1\s\src\coreclr\vm\appdomain.cpp @ 5337] 
2b 00000049`06b1ada0 00007ff9`4237233f     coreclr!BINDER_SPACE::AssemblyBinder::BindUsingHostAssemblyResolver+0x1c [D:\a\_work\1\s\src\coreclr\binder\assemblybinder.cpp @ 1423] 
2c 00000049`06b1adf0 00007ff9`422aabad     coreclr!CLRPrivBinderAssemblyLoadContext::BindAssemblyByName+0x16f [D:\a\_work\1\s\src\coreclr\binder\clrprivbinderassemblyloadcontext.cpp @ 87] 
2d 00000049`06b1aea0 00007ff9`422a9e93     coreclr!AssemblySpec::Bind+0x131 [D:\a\_work\1\s\src\coreclr\vm\coreassemblyspec.cpp @ 133] 
2e 00000049`06b1b7e0 00007ff9`4228fe36     coreclr!AppDomain::BindAssemblySpec+0x193 [D:\a\_work\1\s\src\coreclr\vm\appdomain.cpp @ 3984] 
2f 00000049`06b1bf30 00007ff9`422621b8     coreclr!PEFile::LoadAssembly+0xbe [D:\a\_work\1\s\src\coreclr\vm\pefile.cpp @ 1479] 
30 00000049`06b1bfe0 00007ff9`4234c1a2     coreclr!Module::LoadAssembly+0x10c [D:\a\_work\1\s\src\coreclr\vm\ceeload.cpp @ 4670] 
31 00000049`06b1c0f0 00007ff9`4229c819     coreclr!Assembly::FindModuleByTypeRef+0x332 [D:\a\_work\1\s\src\coreclr\vm\assembly.cpp @ 1083] 
32 00000049`06b1c210 00007ff9`42251fa2     coreclr!ClassLoader::LoadTypeDefOrRefThrowing+0x289 [D:\a\_work\1\s\src\coreclr\vm\clsload.cpp @ 2612] 
33 00000049`06b1c300 00007ff9`422510c6     coreclr!MemberLoader::GetDescFromMemberRef+0x332 [D:\a\_work\1\s\src\coreclr\vm\memberload.cpp @ 295] 
34 00000049`06b1c5b0 00007ff9`4384cd60     coreclr!CEEInfo::resolveToken+0xcf6 [D:\a\_work\1\s\src\coreclr\vm\jitinterface.cpp @ 1164] 
35 00000049`06b1c9d0 00007ff9`4384adbd     clrjit!Compiler::impImportBlockCode+0x2c0 [D:\a\_work\1\s\src\coreclr\jit\importer.cpp @ 14628] 
36 00000049`06b1d0a0 00007ff9`4384aa2a     clrjit!Compiler::impImportBlock+0x7d [D:\a\_work\1\s\src\coreclr\jit\importer.cpp @ 17868] 
37 00000049`06b1d1a0 00007ff9`4384a44e     clrjit!Compiler::impImport+0x41a [D:\a\_work\1\s\src\coreclr\jit\importer.cpp @ 18948] 
38 00000049`06b1d210 00007ff9`4387814c     clrjit!Compiler::fgImport+0xe [D:\a\_work\1\s\src\coreclr\jit\flowgraph.cpp @ 632] 
39 (Inline Function) --------`--------     clrjit!Phase::Run+0x1e [D:\a\_work\1\s\src\coreclr\jit\phase.cpp @ 61] 
3a (Inline Function) --------`--------     clrjit!DoPhase+0x51 [D:\a\_work\1\s\src\coreclr\jit\phase.h @ 136] 
3b 00000049`06b1d240 00007ff9`437d6cb1     clrjit!Compiler::compCompile+0x16c [D:\a\_work\1\s\src\coreclr\jit\compiler.cpp @ 4512] 
3c 00000049`06b1d4b0 00007ff9`437dae9a     clrjit!Compiler::compCompileHelper+0x291 [D:\a\_work\1\s\src\coreclr\jit\compiler.cpp @ 6422] 
3d 00000049`06b1d560 00007ff9`437dc292     clrjit!Compiler::compCompile+0x24a [D:\a\_work\1\s\src\coreclr\jit\compiler.cpp @ 5685] 
3e 00000049`06b1d610 00007ff9`4388d663     clrjit!jitNativeCode+0x262 [D:\a\_work\1\s\src\coreclr\jit\compiler.cpp @ 7055] 
3f 00000049`06b1d7b0 00007ff9`422c3051     clrjit!CILJit::compileMethod+0x83 [D:\a\_work\1\s\src\coreclr\jit\ee_il_dll.cpp @ 279] 
40 (Inline Function) --------`--------     coreclr!invokeCompileMethodHelper+0x86 [D:\a\_work\1\s\src\coreclr\vm\jitinterface.cpp @ 12774] 
41 (Inline Function) --------`--------     coreclr!invokeCompileMethod+0xc5 [D:\a\_work\1\s\src\coreclr\vm\jitinterface.cpp @ 12839] 
42 00000049`06b1d820 00007ff9`422c270d     coreclr!UnsafeJitFunction+0x7f1 [D:\a\_work\1\s\src\coreclr\vm\jitinterface.cpp @ 13355] 
43 00000049`06b1dd10 00007ff9`422c228e     coreclr!MethodDesc::JitCompileCodeLocked+0x1f1 [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 1051] 
44 00000049`06b1dee0 00007ff9`42261ff9     coreclr!MethodDesc::JitCompileCodeLockedEventWrapper+0x466 [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 920] 
45 00000049`06b1e040 00007ff9`42263f48     coreclr!MethodDesc::JitCompileCode+0x2a9 [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 860] 
46 (Inline Function) --------`--------     coreclr!MethodDesc::PrepareILBasedCode+0x5ae [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 439] 
47 (Inline Function) --------`--------     coreclr!MethodDesc::PrepareCode+0x5ae [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 332] 
48 00000049`06b1e0f0 00007ff9`422633fc     coreclr!CodeVersionManager::PublishVersionableCodeIfNecessary+0x7f8 [D:\a\_work\1\s\src\coreclr\vm\codeversion.cpp @ 1701] 
49 00000049`06b1e620 00007ff9`4226315b     coreclr!MethodDesc::DoPrestub+0x16c [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 2215] 
4a 00000049`06b1e740 00007ff9`4239bf35     coreclr!PreStubWorker+0x21b [D:\a\_work\1\s\src\coreclr\vm\prestub.cpp @ 2039] 
4b 00000049`06b1e8d0 00007ff8`e80a0229     coreclr!ThePreStub+0x55
4c 00000049`06b1e980 00007ff8`e807643b     0x00007ff8`e80a0229
4d 00000049`06b1ecb0 00007ff8`e6a738e1     0x00007ff8`e807643b
4e 00000049`06b1ecf0 00007ff8`e6a737de     0x00007ff8`e6a738e1
4f 00000049`06b1edb0 00007ff8`e6a73756     0x00007ff8`e6a737de
50 00000049`06b1edf0 00007ff8`e6a731a8     0x00007ff8`e6a73756
51 00000049`06b1ee30 00007ff8`e8042469     0x00007ff8`e6a731a8
52 00000049`06b1ee70 00007ff8`e8030746     0x00007ff8`e8042469
53 00000049`06b1eed0 00007ff8`e8030531     0x00007ff8`e8030746
54 00000049`06b1ef50 00007ff8`e8047ec3     0x00007ff8`e8030531
55 00000049`06b1ef90 00007ff8`e6a769f4     0x00007ff8`e8047ec3
56 00000049`06b1efe0 00007ff8`e8047b39     0x00007ff8`e6a769f4
57 00000049`06b1f050 00007ff8`e6a74548     0x00007ff8`e8047b39
58 00000049`06b1f0c0 00007ff8`e6a741bf     0x00007ff8`e6a74548
59 00000049`06b1f140 00007ff8`e6a737de     0x00007ff8`e6a741bf
5a 00000049`06b1f180 00007ff8`e6a73756     0x00007ff8`e6a737de
5b 00000049`06b1f1c0 00007ff8`e6a731a8     0x00007ff8`e6a73756
5c 00000049`06b1f200 00007ff8`e8042469     0x00007ff8`e6a731a8
5d 00000049`06b1f240 00007ff8`e8030746     0x00007ff8`e8042469
5e 00000049`06b1f2a0 00007ff8`e8030531     0x00007ff8`e8030746
5f 00000049`06b1f320 00007ff8`e8047ec3     0x00007ff8`e8030531
60 00000049`06b1f360 00007ff8`e6a769f4     0x00007ff8`e8047ec3
61 00000049`06b1f3b0 00007ff8`e8047b39     0x00007ff8`e6a769f4
62 00000049`06b1f420 00007ff8`e6a74548     0x00007ff8`e8047b39
63 00000049`06b1f490 00007ff8`e6a741bf     0x00007ff8`e6a74548
64 00000049`06b1f510 00007ff8`e6a737de     0x00007ff8`e6a741bf
65 00000049`06b1f550 00007ff8`e6a73756     0x00007ff8`e6a737de
66 00000049`06b1f590 00007ff8`e6a731a8     0x00007ff8`e6a73756
67 00000049`06b1f5d0 00007ff8`e8042469     0x00007ff8`e6a731a8
68 00000049`06b1f610 00007ff8`e8030746     0x00007ff8`e8042469
69 00000049`06b1f670 00007ff8`e8030531     0x00007ff8`e8030746
6a 00000049`06b1f6f0 00007ff8`e8042ead     0x00007ff8`e8030531
6b 00000049`06b1f730 00007ff8`e6a7212e     0x00007ff8`e8042ead
6c 00000049`06b1f7c0 00007ff8`e6a72042     0x00007ff8`e6a7212e
6d 00000049`06b1f810 00007ff8`e6a71fd1     0x00007ff8`e6a72042
6e 00000049`06b1f850 00007ff8`e73a9e5e     0x00007ff8`e6a71fd1
6f 00000049`06b1f880 00007ff8`e73a9dd0     0x00007ff8`e73a9e5e
70 00000049`06b1f8c0 00007ff8`e7e190bc     0x00007ff8`e73a9dd0
71 00000049`06b1f930 00007ff8`e7e18ed2     0x00007ff8`e7e190bc
72 00000049`06b1f9f0 00007ff8`e42139ce     0x00007ff8`e7e18ed2
73 00000049`06b1fa50 00007ff8`e4213900     0x00007ff8`e42139ce
74 00000049`06b1faa0 00007ff7`11c91e3a     0x00007ff8`e4213900
75 00000049`06b1fb00 00007ff7`11c91352     EXCEL!_DoCallCore+0xa7e
76 00000049`06b1fc70 00007ff7`1121a9fa     EXCEL!_DoCall+0xd0
77 00000049`06b1fdd0 00007ff7`10e06cda     EXCEL!DoCall+0xaa
78 00000049`06b1fe60 00007ff7`101edaa5     EXCEL!XLExpressionService::HrDoCall+0x17a
79 00000049`06b1fef0 00007ff7`101eb64f     EXCEL!DLLCallMT+0xb05
7a 00000049`06b20740 00007ff7`101d56e8     EXCEL!fnCallMT+0x4cf
7b 00000049`06b20ae0 00007ff7`0fa556bf     EXCEL!FuncMoperFHandleFuncMT+0x4e8
7c 00000049`06b20bc0 00007ff7`0fa0ba05     EXCEL!OldEval::FHandleFunc+0xa1f
7d 00000049`06b20cc0 00007ff7`105ab499     EXCEL!OldEval::GrbitDoEvalCore+0x15d8
7e 00000049`06b20dd0 00007ff7`105efd05     EXCEL!RecalcThread::CalcExp+0x286
7f 00000049`06b20ea0 00007ff7`1059c03c     EXCEL!MainRecalcThread::RecalcMain+0x11c5
80 00000049`06b21340 00007ff7`1059768b     EXCEL!RecalcEngine::RecalcMain+0x7c
81 00000049`06b213a0 00007ff7`10597265     EXCEL!RecalcEngine::GrbitDoRecalcSubpass+0x23b
82 00000049`06b21410 00007ff7`10597d05     EXCEL!RecalcEngine::GrbitDoRecalcPass+0x1a5
83 00000049`06b21480 00007ff7`1059697a     EXCEL!RecalcEngine::GrbitRecalcFormulas+0x185
84 00000049`06b215a0 00007ff7`1053ce65     EXCEL!RecalcEngine::GrbitDoRecalc+0x378
85 00000049`06b21730 00007ff7`10e061d8     EXCEL!ExpressionService::GrbitDoRecalc+0x465
86 00000049`06b21890 00007ff7`114bc1d8     EXCEL!XLExpressionService::GrbitXLRecalcAll+0x298
87 00000049`06b23db0 00007ff7`114bb065     EXCEL!HrGlobalRecalcDeprecated+0x8d8
88 00000049`06b24b40 00007ff7`114b9176     EXCEL!HrCalcAllNonCell+0x1065
89 00000049`06b24c00 00007ff7`0faa2326     EXCEL!CalcDoc+0x16
8a 00000049`06b24c30 00007ff7`0f999d55     EXCEL!ActionAdapter::CeDoActionFromIcetab+0x3f4
8b 00000049`06b252b0 00007ff7`0f9da75b     EXCEL!CeDoMenu+0x2229
8c 00000049`06b25730 00007ff7`0f9da24c     EXCEL!CommandMT+0x3c6
8d 00000049`06b25a90 00007ff7`0fa5641a     EXCEL!FuncMoperCetab+0x46c
8e 00000049`06b25d20 00007ff7`0fa569d6     EXCEL!XLExpressionService::HrFuncMoper+0x2ba
8f 00000049`06b283b0 00007ff7`0faad1ec     EXCEL!XLExpressionService::HrFuncMoperOldOpers+0x456
90 00000049`06b28710 00007ff7`0fe38326     EXCEL!HrExecPoad+0x40b
91 00000049`06b28900 00007ff7`0faadc95     EXCEL!HrHandleWsPoad+0x2fc
92 00000049`06b28cb0 00007ff7`0faad6a5     EXCEL!BCP::Unadvise+0x1c7
93 00000049`06b28e80 00007ff7`0f97ce9e     EXCEL!HrExecPoad+0x8c5
94 00000049`06b28ee0 00007ff7`0f9dcb1e     EXCEL!HrBobjInvoke+0xc5e
95 00000049`06b2b740 00007ff7`0f9e467b     EXCEL!_HrBobjVtblDispatch+0x27e
96 00000049`06b2bb40 0000016c`0000001c     EXCEL!HrBobjVtblDispatch+0x152
97 00000049`06b2bb48 0000016c`2b5f9e20     0x0000016c`0000001c
98 00000049`06b2bb50 00000049`06b2bd60     0x0000016c`2b5f9e20
99 00000049`06b2bb58 0000016c`129caa3e     0x00000049`06b2bd60
9a 00000049`06b2bb60 00000000`0000000c     0x0000016c`129caa3e
9b 00000049`06b2bb68 00007ff7`10133f20     0xc
9c 00000049`06b2bb70 00000000`00000000     EXCEL!HrWorksheetCheckBoxes
jkotas commented 8 months ago

is there anything you suggest we could look into/try?

Analyze the deadlock further. This stacktrace that you have shared above suggests that the .NET BGC thread is waiting for a loader lock. What is the stacktrace of the thread holding this lock and why is that thread not releasing it?

.NET BGC thread

0:097> kp
 # Child-SP          RetAddr               Call Site
00 00000049`08eff488 00007ff9`b57aeb32     ntdll!NtWaitForSingleObject+0x14
01 00000049`08eff490 00007ff9`b57677c3     ntdll!LdrpDrainWorkQueue+0x15e
02 00000049`08eff4d0 00007ff9`b57c5064     ntdll!LdrpInitializeThread+0x8b
03 00000049`08eff5b0 00007ff9`b57c4c43     ntdll!LdrpInitialize+0x408
04 00000049`08eff650 00007ff9`b57c4bee     ntdll!LdrpInitialize+0x3b
05 00000049`08eff680 00000000`00000000     ntdll!LdrInitializeThunk+0xe
ghost commented 7 months ago

This issue has been marked needs-author-action and may be missing some important information.

ghost commented 6 months ago

This issue has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

dotnet-policy-service[bot] commented 6 months ago

This issue will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days.