.NET 4.5:在.NET运行时的内部错误(80131506)/禁用并发GC [英] .NET 4.5: internal error in the .NET Runtime (80131506) / disabling concurrent GC

查看:5445
本文介绍了.NET 4.5:在.NET运行时的内部错误(80131506)/禁用并发GC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个长期运行的.NET 4.5的应用程序,随机崩溃,留下我在事件日志中的问题标题中提到的消息。这个问题被再现3种不同的机器和2个不同的系统(2008 R2和2012年)。应用程序不使用任何不安全/非托管的组件,这是纯粹的管理.NET,唯一的非托管的东西作为CLR本身。

I have a long-running .NET 4.5 application that crashes randomly, leaving the message I've mentioned in the question title in the event log. The issue is reproduced on 3 different machines and 2 different systems (2008 R2 and 2012). Application doesn't use any unsafe/unmanaged components, it's pure managed .NET, with the only unmanaged thing being the CLR itself.

下面是我从转储中提取的坠机现场的堆栈跟踪:

Here's the stack trace of the crash site that I've extracted from the dump:

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    

这个问题非常类似于讨论的一个<一个href="http://stackoverflow.com/questions/4367664/application-crashes-with-internal-error-in-the-net-runtime">here,所以我想,话题提出的解决方案,但没有人帮助:

This issue closely resembles the one that was discussed here, so I tried the solutions suggested in that topic, but none of them helped:

  • 我试着安装修补程序,但它不会安装在任何我的机器(KB2640103不适,或阻止其他条件的计算机上),这实际上是有道理的,因为我使用的是4.5,而不是4.0。

  • I've tried installing this hotfix, but it won't install on any of my machines (KB2640103 does not apply, or is blocked by another condition on your computer), which actually makes sense, because I'm using 4.5, not 4.0.

我已经试过禁用并发GC和/或使服务器GC。现在我的app.config的相关部分看起来是这样的:

I've tried disabling concurrent GC and/or enabling server GC. Right now the relevant part of my app.config looks like this:

<?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个线程与下面的堆栈跟踪:

Though the weird thing is I still find multiple GC-related threads in the process dump. Besides the one the crash occurs in, there are 7 threads with the following stack trace:

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(这就是我居然列出的配置为)。

Which makes me wondering if I could somehow screw up disabling the concurrent GC (that's what I actually listed the config for).

我觉得它包装了一下,我设法找到为止。我真的可以使用上如何进行处理这一问题有所帮助。

I think that wraps up what I've managed to find so far. I could really use some help on how to proceed with dealing with this issue.

推荐答案

我从我在我们的应用以往的经验。这如有异常得不到处理,直到终结水平可以引起的,如果去...它会崩溃的应用程序。

I am drawing from my past experience in our application. This could be caused if an exception goes unhandled till the Finalizer level, and if it goes... it will crash the application.

在GC上的配置做任何事情。

Before doing anything on the GC configuration..

一个快速检查... 您使用任务并行库 如果是请确保您处理异常正常。如果从不同的线程的例外是左未处理它去到终结,然后应用程序崩溃。有两种方法可以巧妙地处理它们。处理聚合的例外是一种方法(我们用来解决!)。

One quick check... Are you using task parallel libraries?. If yes make sure you are handling exceptions properly. If exceptions from different threads are left unhandled it goes till Finalizer which then crashes the application. There are couple of ways to handle them neatly. Handling 'Aggregate' Exception is one way (that we used to solve!).

http://msdn.microsoft.com/en-us/library/ dd537614.aspx

我没有50点,添加评论,所以将其添加为一个答案...

这篇关于.NET 4.5:在.NET运行时的内部错误(80131506)/禁用并发GC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆