首页 > Linux操作系统 > Linux操作系统 > 应用内存溢出 --ASP.NET
Root cause of Crash:
Out of memory cause your MIC2006.AP application pool crash;
Possible cause of Out of memory:
01. You ap set debug to true in your web.config
02. Your dll is compile as debug module.
03. GC is running as Server mode.
Suggestions of Out of memory:
Please follow the below KB to solve the known issue which is caused by debug setting..
Quick things to check when you experience high memory levels in ASP.NET
http://support.microsoft.com/?id=893660
請將Web.config中的debug及Trace均設為False。還有您的所有程式請確保compile為Release Mode
Application set up for debugging
One reason for high memory that we see here in Support a lot is when you have debugging, tracing, or both enabled for your application. While you are developing your application, this is a necessity. By default, when you create your application in Visual Studio .NET, you will see the following attribute set in your Web.config file:
and/or
Also, when you do a final build of your application, make sure that you do this in "Release" mode, not "Debug" mode.
Note若您在關閉Debug後出現timeout的問題,請在Web.config中設定executionTimeout的值,預設是90秒Timeout,請依您的程式所需執行時間來設定。
useFullyQualifiedRedirectUrl="true"
executionTimeout="90"
versionHeader="1.1.4128"/>
Please follow the below KB to solve the known issue which is caused GC server mode.
You may receive an error message, or the computer may stop responding, when you host Web applications that use ASP.NET on a computer that is running Windows Server 2003
http://support.microsoft.com/?id=911716
SYMPTOMS
When you host Web applications that use Microsoft ASP.NET on a computer that is running Microsoft Windows Server 2003, you may experience decreased performance. This issue may occur when you host the Web applications in multiple application pools on a multiprocessor computer. Additionally, you may experience one or more of the following issues when available memory is low:
|
• |
You may receive exceptions of type System.OutOfMemoryException. |
|
• |
You may receive the following error message when you try to open an ASP.NET Web page: Server Application Unavailable |
|
• |
The computer may stop responding. |
CAUSE
These issues occur because the Microsoft .NET Framework common language runtime (CLR) uses the Server garbage collector (GC) on multiprocessor computers.
WORKAROUND
To work around these issues, configure the .NET Framework common language runtime to use the Workstation garbage collector. The Workstation garbage collector is optimized to reduce garbage collector pause times for interactive applications. Additionally, the Workstation garbage collector creates only one heap. Therefore, the Workstation garbage collector uses less memory when you run applications on multiprocessor computers.
To configure the .NET Framework common language runtime to use the Workstation garbage collector, add the following code after the
|
• |
If you are running the Microsoft .NET Framework 2.0: %WINDIR%\Microsoft.NET\Framework\v2.0.50727 |
|
• |
If you are running the Microsoft .NET Framework 1.1: %WINDIR%\Microsoft.NET\Framework\v1.1.4322 |
Details dump analysis:
The crash is caused by an CLR exception, let’s check what the exception is.
From the below call stack, we can see the exception object is 0x6a07d764.
0:012> kpnL
# ChildEBP RetAddr
00 01d2f0e0 792137b0 kernel32!RaiseException(unsigned long dwExceptionCode = 0xe0434f4d, unsigned long dwExceptionFlags = 1, unsigned long nNumberOfArguments = 0, unsigned long * lpArguments = 0x00000000)+0x53
01 01d2f138 79213733 mscorsvr!RaiseTheException(class Object * throwable = 0x6a07d764, int rethrow = 0)+0xa0
02 01d2f160 792136e7 mscorsvr!RealCOMPlusThrow(class Object * throwable = 0x6a07d764, int rethrow = 0)+0x48
03 01d2f170 792ca148 mscorsvr!RealCOMPlusThrow(class Object * throwable = 0x6a07d764)+0xd
04 01d2f1ac 792ca598 mscorsvr!LocalUnwind(struct _EXCEPTION_REGISTRATION_RECORD * pEstFrame. = 0x00000000, class ContextTransitionFrame. * pFrame. = 0x18c0ead0)+0x12c
05 01d2f1c0 7c828752 mscorsvr!ContextTransitionFrameHandler(struct _EXCEPTION_RECORD * pExcepRecord = 0x01d2f2a4, struct _EXCEPTION_REGISTRATION_RECORD * pEstFrame. = 0x01d2fc60, struct _CONTEXT * pContext = 0x01d2f2b8, void * pDispatcherContext = 0x01d2f280)+0xa4
06 01d2f1e4 7c828723 ntdll!ExecuteHandler2(void)+0x26
07 01d2f28c 7c82855e ntdll!ExecuteHandler(void)+0x24
08 01d2f28c 77e4bee7 ntdll!KiUserExceptionDispatcher(void)+0xe
09 01d2f5d8 792137b0 kernel32!RaiseException(unsigned long dwExceptionCode = 0xe0434f4d, unsigned long dwExceptionFlags = 1, unsigned long nNumberOfArguments = 0, unsigned long * lpArguments = 0x00000000)+0x53
0a 01d2f630 79213733 mscorsvr!RaiseTheException(class Object * throwable = 0x0e4e003c, int rethrow = 0)+0xa0
0b 01d2f658 792136e7 mscorsvr!RealCOMPlusThrow(class Object * throwable = 0x0e4e003c, int rethrow = 0)+0x48
0c 01d2f668 792b63a0 mscorsvr!RealCOMPlusThrow(class Object * throwable = 0x0e4e003c)+0xd
0d 01d2f670 792684ff mscorsvr!RealCOMPlusThrowOM(void)+0xc
0e 01d2f88c 791ba542 mscorsvr!GCHeap::Alloc(struct alloc_context * acontext = 0x18c0eb08, unsigned long size = 0x20, unsigned long flags = 2)+0x139
0f 01d2f8a0 791bf2ea mscorsvr!Alloc(unsigned long size = 0x20, int bFinalize = 0, int bContainsPointers = 262144)+0x3a
10 01d2f8c0 791bf338 mscorsvr!FastAllocateObject(class MethodTable * pMT = 0x79c0d6f0)+0x25
11 01d2f92c 79a29e96 mscorsvr!JIT_NewFast(struct CORINFO_CLASS_STRUCT_ * typeHnd_ = 0x01d2f640)+0x2c
WARNING: Stack unwind information not available. Following frames may be wrong.
12 01d2f968 791b3205 mscorlib_79990000+0x99e96
13 01d2f974 791bb6bd mscorsvr!CallDescrWorker(void * pSrcEnd = 0x01d2f9c8, unsigned int numStackSlots = 2, struct ArgumentRegisters * pArgumentRegisters = 0x01d2f998, void * pTarget = 0x79bda99b)+0x30
From the below command we see the real CLR exception is System.OutOfMemoryException.
0:012> !dumpobj 0x6a07d764
Name: System.TypeInitializationException
MethodTable 0x79c0cd64
EEClass 0x79c0cde0
Size 68(0x44) bytes
GC Generation: -1
mdToken: 0x020000cf (c:\windows\microsoft.net\framework\v1.1.4322\mscorlib.dll)
FieldDesc*: 0x79c0ce44
MT Field Offset Type Attr Value Name
0x79b9687c 0x400001d 0x4 CLASS instance 0x6a078918 _className
0x79b9687c 0x400001e 0x8 CLASS instance 0x00000000 _exceptionMethod
0x79b9687c 0x400001f 0xc CLASS instance 0x6a078a38 _exceptionMethodString
0x79b9687c 0x4000020 0x10 CLASS instance 0x6a078970 _message
0x79b9687c 0x4000021 0x14 CLASS instance 0x6a078cd4 _innerException
0x79b9687c 0x4000022 0x18 CLASS instance 0x00000000 _helpURL
0x79b9687c 0x4000023 0x1c CLASS instance 0x00000000 _stackTrace
0x79b9687c 0x4000024 0x20 CLASS instance 0x00000000 _stackTraceString
0x79b9687c 0x4000025 0x24 CLASS instance 0x00000000 _remoteStackTraceString
0x79b9687c 0x4000026 0x2c System.Int32 instance 0 _remoteStackIndex
0x79b9687c 0x4000027 0x30 System.Int32 instance -2146233036 _HResult
0x79b9687c 0x4000028 0x28 CLASS instance 0x6a078bc0 _source
0x79b9687c 0x4000029 0x34 System.Int32 instance 0 _xptrs
0x79b9687c 0x400002a 0x38 System.Int32 instance 0 _xcode
0x79c0cd64 0x40002ba 0x3c CLASS instance 0x6a078be4 _typeName
-----------------
Exception 6a07d764 in MT 79c0cd64: System.TypeInitializationException
_message: The type initializer for "System.Threading.Thread" threw an exception.
_innerException:
Exception 6a078cd4 in MT 79b96d44: System.OutOfMemoryException
In order to solve crash issue, we have to solve high memory issue first. Let’s check the dump deeply.
I find that there are 37 web applications which set debug to true and 221 debug modules.
Debug set to true for Runtime: 24fdb5c, AppDomain: /MASLD001
Debug set to true for Runtime: 25bfa28, AppDomain: /MASMO002
Debug set to true for Runtime: 29381a4, AppDomain: /MAXRAY701
Debug set to true for Runtime: 2993c78, AppDomain: /MIWIP701
Debug set to true for Runtime: 2cd8954, AppDomain: /MIP2L702.2
Debug set to true for Runtime: 2d78aa4, AppDomain: /MILCS701
Debug set to true for Runtime: 2e32e44, AppDomain: /MARWORK002
Debug set to true for Runtime: 2eeb1fc, AppDomain: /MIPACKST001
Debug set to true for Runtime: 64eb6a4, AppDomain: /PORTAL
Debug set to true for Runtime: 650fbc8, AppDomain: /BASICREPORT
Debug set to true for Runtime: 660fe5c, AppDomain: /MACHECK000
Debug set to true for Runtime: 66c6808, AppDomain: /MADOA001
Debug set to true for Runtime: 68fb570, AppDomain: /KB
Debug set to true for Runtime: 6b0cf64, AppDomain: /MIAPRE000
Debug set to true for Runtime: 6bbbbc4, AppDomain: /SCT
Debug set to true for Runtime: 6cd59c0, AppDomain: /MAROSA743
Debug set to true for Runtime: 70291fc, AppDomain: /MAAPI000
Debug set to true for Runtime: a57bdb4, AppDomain: /MARPR003
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/30193/viewspace-524657/ ,如需转载,请注明出处,否则将追究法律责任。