我有一個長期運行的.NET 4.5應用程序隨機崩潰,留下了我在問題標題中提到的消息。這個問題在3個不同的機器和2個不同的系統(2008 R2和2012)上覆制。應用程序不使用任何不安全/非託管組件,它是純粹的託管.NET,唯一不受管理的東西是CLR本身。.NET 4.5:.NET運行時的內部錯誤(80131506)/禁用併發的GC
下面是我從轉儲中提取的墜機現場的堆棧跟蹤:
clr.dll!MethodTable::GetCanonicalMethodTable()
clr.dll!SVR::CFinalize::ScanForFinalization() - 0x1a31b bytes
clr.dll!SVR::gc_heap::mark_phase() + 0x328 bytes
clr.dll!SVR::gc_heap::gc1() + 0x95 bytes
clr.dll!SVR::gc_heap::garbage_collect() + 0x16e bytes
clr.dll!SVR::gc_heap::gc_thread_function() + 0x3e bytes
clr.dll!SVR::gc_heap::gc_thread_stub() + 0x77 bytes
kernel32.dll!BaseThreadInitThunk() + 0x1a bytes
ntdll.dll!RtlUserThreadStart() + 0x21 bytes
這個問題非常類似於討論here的人,所以我想這個話題在建議的解決方案,但他們沒有幫助:
我已經嘗試安裝this修補程序,但它不會對我的任何機器上安裝(KB2640103不適,或阻止另一個條件您的計算機上),這實際上有道理,是的因爲我使用4.5,而不是4.0。
我試過禁用併發GC和/或啓用服務器GC。現在我的app.config相關的部分看起來像這樣:
<?xml version="1.0"?> <configuration> <runtime> <gcConcurrent enabled="false"/> <gcServer enabled="true" /> </runtime> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/> </startup></configuration>
雖然奇怪的是我仍然覺得在這個過程中轉儲多個GC相關的線程。除了發生在崩潰的一個,有7個線程與以下堆棧跟蹤:
ntdll.dll!NtWaitForSingleObject() + 0xa bytes
KERNELBASE.dll!WaitForSingleObjectEx() + 0x9a bytes
clr.dll!CLREventBase::WaitEx() + 0x13f bytes
clr.dll!CLREventBase::WaitEx() + 0xf7 bytes
clr.dll!CLREventBase::WaitEx() + 0x78 bytes
clr.dll!SVR::t_join::join() + 0xd8 bytes
clr.dll!SVR::gc_heap::scan_dependent_handles() + 0x65 bytes
clr.dll!SVR::gc_heap::mark_phase() + 0x347 bytes
clr.dll!SVR::gc_heap::gc1() + 0x95 bytes
clr.dll!SVR::gc_heap::garbage_collect() + 0x16e bytes
clr.dll!SVR::gc_heap::gc_thread_function() + 0x3e bytes
clr.dll!SVR::gc_heap::gc_thread_stub() + 0x77 bytes
kernel32.dll!BaseThreadInitThunk() + 0x1a bytes
ntdll.dll!RtlUserThreadStart() + 0x21 bytes
這讓我想知道如果我能以某種方式搞砸了禁用併發GC(這是我真正所列出的配置爲)。
我認爲這包括了我迄今爲止設法找到的東西。我真的可以用一些幫助來解決這個問題。
GC堆上的託管對象的對象頭已損壞,無法再找到該類型的方法表。您總是先查找與之互操作的非託管代碼以查看原因:修改gc config並不能解決問題 –
也許在終結器中存在問題?你可以嘗試在終結器中設置斷點或將它們註釋掉 – DSway
'scan_dependent_handles':依賴句柄最近被添加到CLR 4.0?)。也許這是CLR的一個真正的bug。 – usr