Asp.Net网站偶尔会在IIS 7.5下挂起

时间:2015-01-29 12:59:55

标签: c# asp.net .net iis garbage-collection

我正在与一个时髦的问题作斗争。经过几天运行Asp.Net 4.5网站变得不负责任。我的配置:Windows 7,IIS 7.5,64位,16Gb。应用程序的内存消耗很小,不应该是一个问题(w3wp.exe在其生命周期内需要大约500Mb的内存)。

我已经检查了应用程序池,它处于运行状态。所以我的第一个猜测是垃圾收集过程中应该存在死锁。应用程序中的所有线程都被GC挂起,并且不允许为新请求分配新线程,因此所有请求都会挂起。

所以我收集了进程转储并将其交给DebugDiag进行分析。记忆分析证实了我的猜测。它向我发出警告:

  

该进程目前处于垃圾收集的中间

然后我切换到crush-hang分析来查看线程。 GC挂起的原因通常是禁用抢占式模式的线程。通过我的应用程序中的所有线程看起来很好:

Debugger Thread ID Managed Thread ID OS Thread ID Thread Object GC Mode Domain Lock Count Apt Exception
7 1 3552 14601f0 Preemptive 1456e80 0 Unknown  
15 2 3476 c5b31e0 Preemptive 1456e80 0 MTA (Finalizer) 
17 3 4696 c608ee0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
18 4 3756 c60cb10 Preemptive 1456e80 0 Unknown  
19 6 4672 d6e51d0 Preemptive 1456e80 0 Unknown (Threadpool Worker) 
20 7 4652 c6caf90 Preemptive c61f8f0 0 MTA  
9 9 4684 d749120 Preemptive 1456e80 0 MTA (Threadpool Completion Port) 
21 10 3220 d738fa0 Preemptive c61f8f0 0 MTA  
22 11 3084 d74af40 Preemptive c61f8f0 0 MTA  
23 12 4280 d740450 Preemptive c61f8f0 0 MTA  
24 13 1212 d740bf0 Preemptive c61f8f0 0 MTA  
25 14 1012 d741390 Preemptive c61f8f0 0 MTA  
26 17 3548 d802660 Preemptive 1456e80 0 Unknown (GC Thread) 
27 18 1800 d802e30 Preemptive 1456e80 0 Unknown (GC Thread) 
28 19 4088 d803600 Preemptive 1456e80 0 Unknown (GC Thread) 
29 20 2880 d803dd0 Preemptive 1456e80 0 Unknown (GC Thread) 
3 8 3872 d805d10 Preemptive 1456e80 0 Unknown  
54  eac7280 Preemptive 1456e80 0   
100  eae16b0 Preemptive 1456e80 0   
94  da67c80 Preemptive 1456e80 0   
107  d6daf30 Preemptive 1456e80 0   
76  d6db700 Preemptive 1456e80 0   
56  eaecf40 Preemptive 1456e80 0   
86  146b210 Preemptive 1456e80 0   
65  d82c930 Preemptive 1456e80 0   
102  da43750 Preemptive 1456e80 0   
101  d90e220 Preemptive 1456e80 0   
25  eb18770 Preemptive 1456e80 0   
85  da64570 Preemptive 1456e80 0   
88  d898820 Preemptive 1456e80 0   
89  eb17fa0 Preemptive 1456e80 0   
93  da5fdd0 Preemptive 1456e80 0   
64  d82d8d0 Preemptive 1456e80 0   
81  d8d4260 Preemptive 1456e80 0   
31 92 3340 eaf17d0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
32 79 4012 eaf1fa0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
55  eaebfa0 Preemptive 1456e80 0   
80  eaf2770 Preemptive 1456e80 0   
108  d82c160 Preemptive 1456e80 0   
50  d90da50 Preemptive 1456e80 0   
49  d8d4a30 Preemptive 1456e80 0   
48  eaf2f40 Preemptive 1456e80 0   
33 84 3556 eb16770 Preemptive 1456e80 0 MTA (Threadpool Worker) 
35 103 740 d808bf0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
34 68 4160 d82d100 Preemptive 1456e80 0 MTA (Threadpool Worker) 
66  eaeb7d0 Preemptive 1456e80 0   
98  eae1e80 Preemptive 1456e80 0   
36 91 5048 eaec770 Preemptive 1456e80 0 Unknown  
37 63 4768 da61540 Preemptive 1456e80 0 MTA (Threadpool Worker) 
38 75 2300 da64d40 Preemptive 1456e80 0 MTA (Threadpool Worker) 
39 99 3980 d90f1c0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
40 52 2512 eb15fa0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
41 90 3560 d8d3a90 Preemptive 1456e80 0 MTA (Threadpool Worker) 
42 67 3624 d90e9f0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
44 53 1404 eae2e20 Preemptive 1456e80 0 MTA (Threadpool Worker) 
43 74 4860 da60d70 Preemptive 1456e80 0 MTA (Threadpool Worker) 
45 83 4424 da63da0 Preemptive 1456e80 0 MTA (Threadpool Worker) 
46 106 1408 d8d5200 Preemptive 1456e80 0 MTA (Threadpool Worker) 
47 61 3100 da605a0 Preemptive 1456e80 0 Unknown  
48 58 2228 eac5b10 Preemptive 1456e80 0 MTA (Threadpool Worker) 
49 43 1448 d807c50 Preemptive 1456e80 0 Unknown  

此外,通过调用堆栈,我无法找到一些表明GC进程真正被触发的调用。我正在寻找像GarbageCollectGeneration(GC) (Threadpool Worker)这样的东西,但没有找到。

所以我是不确定的国王:我真的有GC运行吗?如果我做了那么哪个线程触发了它?为什么没有完成?


转储中另一个有趣的观察是“Previous .NET Exceptions”部分。它说:

Exception Type   Count   Message   Stack Trace
System.Exception    1    <none>     
System.OutOfMemoryException    1    <none>     
System.StackOverflowException    1    <none>     
System.ExecutionEngineException    1    <none>     
System.Threading.ThreadAbortException    2    <none>     
System.Web.HttpException    2    The remote host closed the connection. The error code is 0x800704CD.    

我知道拥有OutOfMemoryExceptionStackOverflowExceptionExecutionEngineException之类的内容并不好。但这可能是该网站耗尽服务的原因吗?如果堆栈不可用,如何跟踪这些异常?

0 个答案:

没有答案