We have a Windows Service which is consuming very huge Virtual Memory. This service is a thread based TCP Socket Listener. we are seeing 32GB virtual memory consumption out of 35GB these days. so we are restarting this service every 10 hours after monitoring Virtual memory reaching to 20GB in order not to crash the production server. Again after 10 hours same thing. So we have captured Crash dumps and Memory leak dumps using DebgDiag and analysed. most of the threads are blocked at socket.receive(). I am not good at memory analysis I am posting Call Stack below.
Entry point | ntdll!RtlUserThreadStart+1d |
Create time | 3/14/2014 8:12:27 PM |
Time spent in user mode | 0 Days 00:00:00.093 |
Time spent in kernel mode | 0 Days 00:00:00.00 |
This thread is waiting on data to be returned from another server via WinSock.
The call to WinSock originated from clr!DoNDirectCall__PatchGetThreadCall+7b
.NET Call Stack
Function |
---|
System.Net.UnsafeNclNativeMethods+OSSOCK.recv(IntPtr, Byte*, Int32, System.Net.Sockets.SocketFlags) |
DomainBoundILStubClass.IL_STUB_PInvoke(IntPtr, Byte*, Int32, System.Net.Sockets.SocketFlags) |
System.Net.Sockets.Socket.Receive(Byte[], Int32, Int32, System.Net.Sockets.SocketFlags, System.Net.Sockets.SocketError ByRef) |
System.Net.Sockets.Socket.Receive(Byte[]) |
Securus.Listener.TcpSocketListener.SocketListenerThreadStart() |
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) |
System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) |
System.Threading.ThreadHelper.ThreadStart() |
Full Call Stack
Function | Source |
---|---|
ntdll!NtWaitForSingleObject+a | |
mswsock!_GSHandlerCheck_SEH+4279 | |
mswsock!_GSHandlerCheck_SEH+798a | |
ws2_32!recv+13c | |
clr!DoNDirectCall__PatchGetThreadCall+7b | |
System_ni+2bd8e2 | |
System_ni+247c65 | |
System_ni+24e315 | |
0x000007ff`00151a83 | |
mscorlib_ni+37168c | |
mscorlib_ni+37159b | |
mscorlib_ni+406c5d | |
clr!CallDescrWorker+84 | |
clr!CallDescrWorkerWithHandler+a9 | |
clr!MethodDesc::CallDescr+2a1 | |
clr!MethodDesc::CallTargetWorker+44 | |
clr!ThreadNative::KickOffThread_Worker+148 | |
clr!VirtualCallStubManager::GenerateResolveCacheElem+aa | |
clr!FullSegmentIterator+194 | |
clr!DomainFile::Activate+375 | |
clr!COMArrayInfo::GetReference+12b | |
clr!ThreadNative::KickOffThread+c0 | |
clr!Thread::intermediateThreadProc+7d | |
kernel32!BaseThreadInitThunk+d | |
ntdll!RtlUserThreadStart+1d At present Socket receiving is in synchronous mode and we want to change to asynchronous. Can any body help me what above call stack explains. So that we can change our implementation accordingly. Thanks in advance. This service is consuming 32GB out of 35GB, but Physical memory is not increasing and it is staying at 4GB to 6 GB constantly. |