我有一个长期运行的.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