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

ASP.NET - EcbGetUnicodeServerVariables 코드에서 System.AccessViolationException 예외 발생


하드 디스크가 날아가서 테스트 환경을 다시 구성하는데다,

RAID 1 구성 시 하드 디스크 장애 발생 해결에 대한 경험담
; https://www.sysnet.pe.kr/2/0/1266

공교롭게도 동시에 IA64 지원이 추가되면서 코드가 memcpy로 변경되는 차이가 발생했습니다.

아이태니엄(IA64: Itanium)에서 겪은 C++ 포인터 연산 문제
; https://www.sysnet.pe.kr/2/0/1265

그런데, 새롭게 구성한 Windows 2003 x86 ASP.NET에서 예전에는 없었던 다음과 같은 오류가 발생했습니다. (이벤트 로그에 남은 내용입니다.)

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/1056073434/Root

Process ID: 2548

Exception: System.AccessViolationException

Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

StackTrace:    at System.Web.UnsafeNativeMethods.EcbGetUnicodeServerVariables(IntPtr pECB, IntPtr buffer, Int32 bufferSizeInChars, Int32[] serverVarLengths, Int32 serverVarCount, Int32 startIndex, Int32& requiredSize)
   at System.Web.Hosting.ISAPIWorkerRequestInProcForIIS6.GetAdditionalServerVariables()
   at System.Web.Hosting.ISAPIWorkerRequestInProc.GetAdditionalServerVar(Int32 index)
   at System.Web.Hosting.ISAPIWorkerRequestInProc.GetServerVariable(String name)
   at System.Web.Hosting.ISAPIWorkerRequest.GetRemoteAddress()
   at System.Web.HttpRequest.get_UserHostAddress()
   at System.ServiceModel.Channels.RemoteEndpointMessageProperty.Initialize(Boolean getHostedPort)
   at System.ServiceModel.Channels.RemoteEndpointMessageProperty.get_Address()
   ...[생략]...
   at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
   at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
   at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

AV 예외가 발생한 이후 w3wp.exe는 여지없이 비정상 종료가 되었음을 알 수 있고,

EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d6968e, P4 system.web, P5 2.0.0.0, P6 4c9a2192, P7 228d, P8 39, P9 system.accessviolationexception, P10 NIL.

For more information(1, 2), see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

AppPool에 지정된 "Rapid-fail protection" 정책에 의해 (기본값) 5분 내에 5번의 w3wp.exe 비정상 종료 현상이 발생하면 IIS는 해당 서비스를 "Service Unavailable"로 판단하고 더 이상의 recycle을 하지 않습니다.

예전에는 이런 경우가 한 번도 없었다가, IA64 코드 변경 이후 나타난 것 같아서 매우 찜찜했는데요. 다행히 ^^; 제니퍼 제품을 설치하지 않은 상태에서도 이런 상황이 재현이 되어서 자신감(!)을 가지고 다른 환경적인 차이를 고민해 봤습니다.

일단, .NET 3.5 및 SP1까지 업데이트 한 후에 발생한 상황이라서 별다른 기대를 하지 않고 '윈도우 업데이트'를 살펴보았는데, 다음과 같은 패치가 아직 설치되지 않고 있었습니다.

Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 3.5 Family Update for .NET versions 2.0 through 3.5 (KB951847) x86
; http://www.update.microsoft.com/windowsupdate/v6/default.aspx?ln=en-us

설치 하고 나니 문제 해결!

휴~~~ 다행입니다. ^^ 비록 가끔은 안 좋은 윈도우 업데이트(1, 2)가 있긴 하지만, 어쨌든 업데이트가 괜히 제공되는 것이 아님을 다시 한번 알게 되는 사건이었습니다.




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







[최초 등록일: ]
[최종 수정일: 8/12/2021]

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)
13590정성태3/31/20241095Linux: 70. Python - uwsgi 응용 프로그램이 k8s 환경에서 OOM 발생하는 문제
13589정성태3/29/20241208닷넷: 2233. C# - 프로세스 CPU 사용량을 나타내는 성능 카운터와 Win32 API파일 다운로드1
13588정성태3/28/20241602닷넷: 2232. C# - Unity + 닷넷 App(WinForms/WPF) 간의 Named Pipe 통신 [2]파일 다운로드1
13587정성태3/27/20241407오류 유형: 900. Windows Update 오류 - 8024402C, 80070643
13586정성태3/27/20241701Windows: 263. Windows - 복구 파티션(Recovery Partition) 용량을 늘리는 방법
13585정성태3/26/20241561Windows: 262. PerformanceCounter의 InstanceName에 pid를 추가한 "Process V2"
13584정성태3/26/20241486개발 환경 구성: 708. Unity3D - C# Windows Forms / WPF Application에 통합하는 방법파일 다운로드1
13583정성태3/25/20241516Windows: 261. CPU Utilization이 100% 넘는 경우를 성능 카운터로 확인하는 방법
13582정성태3/19/20241649Windows: 260. CPU 사용률을 나타내는 2가지 수치 - 사용량(Usage)과 활용률(Utilization)파일 다운로드1
13581정성태3/18/20241794개발 환경 구성: 707. 빌드한 Unity3D 프로그램을 C++ Windows Application에 통합하는 방법
13580정성태3/15/20241323닷넷: 2231. C# - ReceiveTimeout, SendTimeout이 적용되지 않는 Socket await 비동기 호출파일 다운로드1
13579정성태3/13/20241524오류 유형: 899. HTTP Error 500.32 - ANCM Failed to Load dll
13578정성태3/11/20241701닷넷: 2230. C# - 덮어쓰기 가능한 환형 큐 (Circular queue)파일 다운로드1
13577정성태3/9/20241974닷넷: 2229. C# - 닷넷을 위한 난독화 도구 소개 (예: ConfuserEx)
13576정성태3/8/20241607닷넷: 2228. .NET Profiler - IMetaDataEmit2::DefineMethodSpec 사용법
13575정성태3/7/20241720닷넷: 2227. 최신 C# 문법을 .NET Framework 프로젝트에 쓸 수 있을까요?
13574정성태3/6/20241641닷넷: 2226. C# - "Docker Desktop for Windows" Container 환경에서의 IPv6 DualMode 소켓
13573정성태3/5/20241586닷넷: 2225. Windbg - dumasync로 분석하는 async/await 호출
13572정성태3/4/20241698닷넷: 2224. C# - WPF의 Dispatcher Queue로 알아보는 await 호출의 hang 현상파일 다운로드1
13571정성태3/1/20241787닷넷: 2223. C# - await 호출과 WPF의 Dispatcher Queue 동작 확인파일 다운로드1
13570정성태2/29/20241755닷넷: 2222. C# - WPF의 Dispatcher Queue 동작 확인파일 다운로드1
13569정성태2/28/20241694닷넷: 2221. C# - LoadContext, LoadFromContext 그리고 GAC파일 다운로드1
13568정성태2/27/20241809닷넷: 2220. C# - .NET Framework 프로세스의 LoaderOptimization 설정을 확인하는 방법파일 다운로드1
13567정성태2/27/20241814오류 유형: 898. .NET Framework 3.5 이하에서 mscoree.tlb 참조 시 System.BadImageFormatException파일 다운로드1
13566정성태2/27/20241831오류 유형: 897. Windows 7 SDK 설치 시 ".NET Development" 옵션이 비활성으로 선택이 안 되는 경우
13565정성태2/23/20241691닷넷: 2219. .NET CLR2 보안 모델에서의 개별 System.Security.Permissions 제어
1  [2]  3  4  5  6  7  8  9  10  11  12  13  14  15  ...