Microsoft MVP성태의 닷넷 이야기
글쓴 사람
정성태 (seongtaejeong at gmail.com)
홈페이지
첨부 파일
 

WinDbg 분석 사례 - IISreset 시점에 w3wp.exe의 crash 발생

이번 사례는 매우 쉽게 해결된 것으로 Full Memory Dump 분석을 너무 어려운 대상이라고 생각하는 분들을 위해서 올려봅니다. ^^




이상하게도, 웹 애플리케이션이 평소에는 아무런 문제가 없는데 iisreset을 하는 시점만 되면 꼭 비정상 종료가 발생합니다. 다행히 테스트 서버에서 발생한 현상이라 원격 디버깅 도구를 연결해 봤는데요, 웬일인지 (iisreset의 영향 때문인 듯) 원인 파악을 위한 단계까지 못 들어가고 그전에 디버깅 세션이 종료해 버립니다.

어쩔 수 없군요, 그렇다면 덤프가 나서야 합니다. ^^

// 참고: 시작하자마자 비정상 종료하는 프로세스의 메모리 덤프 - procdump
// 관리자 권한으로 실행

C:\temp> procdump -ma -i c:\temp

이후 iisreset을 하면 덤프가 생성되고, Debug Analysis에 맡겨 자동 분석했더니 이런 결과가 나왔습니다.

...[생략]...
Analysis Summary
 Error
Description	Recommendation
In w3wp.exe_...103043.dmp the assembly instruction at coreclr!ProcessCLRException+101a13 in C:\TestWebApp\coreclr.dll from Microsoft Corporation has caused an access violation exception (0xC0000005) when trying to read from memory location 0x00000000 on thread 22
Please follow up with the vendor Microsoft Corporation for C:\TestWebApp\coreclr.dll
 Notification
Description	Recommendation
DebugDiag determined that this dump file (w3wp.exe_...103043.dmp) is a crash dump and did not perform any hang analysis.	To run both hang rules and crash rules on crash dumps, select the following option in the 'Preferences' tab of the 'Settings' page in DebugDiag.Analysis.exe:

    'For crash dumps, run hang rules and crash rules'
Analysis Details
CrashHangAnalysis
Report for w3wp.exe_...103043.dmp
Type of Analysis Performed	Crash Analysis
Machine Name	WIN2019
Operating System	Windows Server - 17763
Number Of Processors	4
Process ID	2320
Process Image	c:\Windows\System32\inetsrv\w3wp.exe
Command Line	c:\windows\system32\inetsrv\w3wp.exe -ap "TestWebApp" -v "v4.0" -l "webengine4.dll" -a \\.\pipe\iisipm24f866b3-407d-42cc-a459-31564ff6c55a -h "C:\inetpub\temp\apppools\TestWebApp\TestWebApp.config" -w "" -m 0 -t 20 -ta 0
System Up-Time	02:08:35
Process Up-Time	00:03:46
Processor Type	X64
Process Bitness	64-Bit
Faulting Thread
Entry point	  coreclr!Thread::intermediateThreadProc
Create time	  2025-06-29 오전 10:27:01
Time spent in user mode	  0 Days 0:0:0.250
Time spent in kernel mode	  0 Days 0:0:0.15



.NET Call Stack

TestWebApp.MyClass.GetWindowInfo(Int32)+be
[[InlinedCallFrame] (TestWebApp.MyClass.GetInfo)] TestWebApp.MyClass.GetInfo(Int32)
TestWebApp.ThreadProc.Run(System.Object)+261
System.Threading.ThreadHelper.ThreadStart_Context(System.Object)+c1
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+fffffffffed32eb4
System.Threading.ThreadHelper.ThreadStart(System.Object)+5e
[[GCFrame]]
[[DebuggerU2MCatchHandlerFrame]]

Full Call Stack

    Arg 1	    Arg 2	    Arg 3	    Arg 4	  Source
coreclr!EEPolicy::HandleFatalError+8b [f:\workspace\_work\1\s\src\vm\eepolicy.cpp @ 1177]	    0000000`00000000	    0000000`00000000	    0000000`00000000	    00002d2`b1a73ab0	  f:\workspace\_work\1\s\src\vm\eepolicy.cpp @ 1177
coreclr!ProcessCLRException+101a2e [f:\workspace\_work\1\s\src\vm\exceptionhandling.cpp @ 1043 + 30]	    00000eb`4f28e970	    00000eb`4f28ebc0	    00053d0`00000000	    00000eb`4f28e300	  f:\workspace\_work\1\s\src\vm\exceptionhandling.cpp @ 1043 + 30
ntdll!RtlpExecuteHandlerForException+f	    00000eb`4f28e290	    0000000`00000000	    0007ff8`4ce960ac	    0007ff8`4cae0000	  
ntdll!RtlDispatchException+40f	    0000000`00000000	    0000000`00000104	    0000000`00000001	    0007ff8`39aaa3d9	  
ntdll!KiUserExceptionDispatch+2e	    0000000`00000025	    0000000`00000000	    00000eb`4f28ebd0	    0007ff7`db81f9e7	  
TestWebApp.MyClass.GetWindowInfo(Int32)+be	    0000000`00000001	    00002ce`660985b0	    0007ff7`db4d1a8e	    00048cd`4aa75421	  
TestWebApp.MyClass.GetInfo()+21	    0000000`00000000	    0000000`00000000	    0000000`00000000	    0000000`00000000	  
TestWebApp.ThreadProc.Run(System.Object)+261	    0000000`00000000	    0000000`00000000	    0000000`00000000	    0000000`00000000	  
System.Threading.ThreadHelper.ThreadStart_Context(System.Object)+c1	    0000000`00000000	    0000000`00000000	    0000000`00000000	    0000000`00000000	  
System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)+fffffffffed32eb4	    0000000`00000000	    0000000`00000000	    0000000`00000000	    0000000`00000000	  
System.Threading.ThreadHelper.ThreadStart(System.Object)+5e	    0000000`00000000	    0000000`00000000	    0000000`00000000	    0000000`00000000	  



CLR Information
There are multiple CLR Runtimes loaded in this process:

CLR version = 4.700.20.6603 (this runtime was selected for analysis)
CLR version = 4.8.4785.0
Microsoft.Diagnostics.Runtime version = 0.9.2.0
Exception Information
CORECLR!PROCESSCLREXCEPTION+101A13In w3wp.exe_...103043.dmp the assembly instruction at coreclr!ProcessCLRException+101a13 in C:\TestWebApp\coreclr.dll from Microsoft Corporation has caused an access violation exception (0xC0000005) when trying to read from memory location 0x00000000 on thread 22


Module Information
Image Name:	C:\TestWebApp\coreclr.dll	  Symbol Type:	PDB
Base address:	0x00000003`00905a4d	  Time Stamp:	Fri Jan 17 11:44:10 2020
Checksum:	0x00000000`00000000	  Comments:	Flavor=Retail
COM DLL:	False	  Company Name:	Microsoft Corporation
ISAPIExtension:	False	  File Description:	Microsoft .NET Runtime
ISAPIFilter:	False	  File Version:	4,700,20,6603 @Commit: 259ce7d4619478cfefe7b0c0f6fa765f765f7e37
Managed DLL:	False	  Internal Name:	CoreCLR.dll
VB DLL:	False	  Legal Copyright:	
Loaded Image Name:	coreclr.dll	  Legal Trademarks:	
Mapped Image Name:		  Original filename:	CoreCLR.dll
Module name:	coreclr	  Private Build:	
Single Threaded:	False	  Product Name:	
Module Size:	5.41 MBytes	  Product Version:	4,700,20,6603 @Commit: 259ce7d4619478cfefe7b0c0f6fa765f765f7e37
Symbol File Name:	e:\symbols\coreclr.pdb\60646608BDB040698AF8C9430E7E480E1\coreclr.pdb	  Special Build:	&


Analysis Rule Summary
Rule Name	Status	Details
CrashHangAnalysis - v (2.3.2.11)	Completed	 
	
Table of Contents
CrashHangAnalysis
Report for w3wp.exe_...103043.dmp
Faulting Thread

오호~~~ 아주 정확하게 원인이 나왔군요, ^^ 자신이 만든 어떤 메서드에서 오류가 발생했다는 것과 재현이 가능하다는 사실에 기반해 어느 부분에서 문제가 발생했는지 유추할 수 있을 것입니다.




회사에서 개발한 제품이 고객사에 설치돼 문제가 발생하는 경우, 대개 원격으로 접속하거나 출장 가야 하는 수밖에 없습니다. (그나마 코로나 시기를 지나면서 원격을 열어주는 고객사가 많아져서 좋군요. ^^) 그런데 문제는, 출장이든 원격이든 결국 문제는 고객사 측의 서버에서 발생한 경우이고, 운이 나쁘다면 테스트 서버가 아닌 실제 운영 서버에서 발생한 경우도 있다는 점입니다. 그런 상황에서 업무 서버에 Visual Studio를 설치하고 디버깅을 하는 것은 현실적으로 불가능하고, 대안으로 Remote Tools를 설치해 원격 디버깅을 고려할 수도 있지만 이것도 쉽지 않을 수 있습니다.

바로 그럴 때 "Full Memory Dump"가 해결책이 될 수 있습니다. 즉, 전반적인 환경과 문제점만 파악하고 메모리 덤프만 확보한 후 나오는 것입니다. 그 후, (고객사에서는 부릴 수 없었던) 여유를 가지고 느긋하게 자신의 익숙한 PC에서 덤프를 분석하면 되는 것입니다.

실제로 최근 사례의 경우, 캄보디아에서 제니퍼가 설치됐는데 모니터링이 동작하지 않는다는 이슈가 올라온 적이 있었는데요, 금융 업무라서 원격도 열어주지 못하는 상황이었습니다. 하지만 다행히 메모리 덤프는 가능하다고 해 파일 전송으로 받아 제 자리에서 분석 후 패치를 했었습니다. 만약, 메모리 덤프가 없었다면... 아마도 캄보디아까지 직접 가야만 했을 지도 모를 일입니다. ^^;




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 7/5/2025]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  [2]  3  4  5  6  7  8  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13937정성태5/24/20251880개발 환경 구성: 746. Windows + WSL2 환경에서 (tensorflow 등의) NVIDIA GPU 인식
13936정성태5/23/20251786개발 환경 구성: 745. Linux / WSL 환경에 Miniconda 설치하기
13935정성태5/20/20251765오류 유형: 957. 파이썬 - pip 사용 시 "ImportError: cannot import name 'html5lib' from 'pip._vendor'" 오류
13934정성태5/20/20252550스크립트: 77. 파이썬 - 'urllib.request' 모듈의 명시적/암시적 로딩 차이
13933정성태5/19/20251933오류 유형: 956. Visual Studio 2022가 17.12 버전부터 업데이트 되지 않는다면?
13932정성태5/18/20252245스크립트: 76. 파이썬 - Version 문자열 다루기(semver 패키지)
13931정성태5/17/20252674스크립트: 75. 파이썬 - Cython 기본 예제 및 컴파일
13930정성태5/17/20252230개발 환경 구성: 744. 파이썬 - Windows embeddable package 환경에서 외부 패키지 사용하는 방법(ex: UFO² 환경 구성)
13929정성태5/16/20252329오류 유형: 955. 파이썬 - "Windows embeddable package" REPL 환경에서 "NameError: name 'exit' is not defined"
13928정성태5/15/20252424오류 유형: 954. UFO² - "'Invalid URL (POST /v1/chat/completions/chat/completions)'"
13927정성태5/15/20252308오류 유형: 953. OpenAI - The API request of HOST_AGENT failed: OpenAI API request exceeded rate limit: Error code: 429
13926정성태5/14/20252991개발 환경 구성: 743. LLM과 윈도우의 만남 - Desktop AgentOS UFO² 기본 환경 구성
13925정성태5/12/20253029닷넷: 2333. C# - (Console 유형의 프로젝트에서) Clipboard 연동파일 다운로드1
13924정성태5/8/20252682닷넷: 2332. C# - (JetBrains Omea Reader 대상으로) 런타임 시에 메서드 가로채기 [2]파일 다운로드1
13923정성태5/5/20252061스크립트: 74. 파이썬 - C# - Python.NET의 RunSimpleScript, Exec, Eval 차이점파일 다운로드1
13922정성태5/3/20252475스크립트: 73. 파이썬 - Windows embeddable package 버전에서 tkinter 환경 구성
13921정성태5/3/20253045오류 유형: 952. 듀얼 채널 메모리 정렬을 지키지 않은 컴퓨터의 Windows 비정상 종료 현상(Blue Screen) [2]
13920정성태5/3/20252996오류 유형: 951. Typed DataSet 생성 중 "Failed to open a connection to the database" 오류
13919정성태5/2/20252615VS.NET IDE: 201. C# - Typed DataSet(XSD)를 위한 연결 문자열 암호화 [1]파일 다운로드1
13918정성태5/2/20253009VS.NET IDE: 200. C# - app.config 파일의 출력을 Configuration(Debug/Release)에 따라 제어하는 방법파일 다운로드1
13917정성태4/30/20252343VS.NET IDE: 199. Directory.Build.props에 정의한 속성에 대해 Condition 제약으로 값을 변경하는 방법
13916정성태4/23/20251925디버깅 기술: 221. WinDbg 분석 사례 - ASP.NET HttpCookieCollection을 다중 스레드에서 사용할 경우 무한 루프 현상 - 두 번째 이야기
13915정성태4/13/20253613닷넷: 2331. C# - 실행 시에 메서드 가로채기 (.NET 9)파일 다운로드1
13914정성태4/11/20254051디버깅 기술: 220. windbg 분석 사례 - x86 ASP.NET 웹 응용 프로그램의 CPU 100% 현상 (4)
13913정성태4/10/20252366오류 유형: 950. Process Explorer - 64비트 윈도우에서 32비트 프로세스의 덤프를 뜰 때 "Error writing dump file: Access is denied." 오류
13912정성태4/9/20252072닷넷: 2330. C# - 실행 시에 메서드 가로채기 (.NET 5 ~ .NET 8)파일 다운로드1
1  [2]  3  4  5  6  7  8  9  10  11  12  13  14  15  ...