Handle Leaks

G

Guest

Hi,

Is anybody aware of problems in .NET where the handle count of an
application increases over time?

We have a server application that is hosted in a Windows Service and accepts
socket connections from distributes processes. Each connection then runs in
it's own thread.

We are having problems on a Windows 2003 Server machine which is running
Chinese Windows. The problem is that the handle count increases over a 7 to
10 day period to a point where it reaches the 10000 limit for a process and
crashes. We have other similar deployments that don't get this problem.

We have used Process Explorer to analyse the Thread types being held by the
process and threads of type 'Event' are the highest in number, with 'File',
'Mutant' & 'Thread' also increasing. These handle types increase at the same
rate during the time the system is running.

Any help would be greatly appreciated!

Ian
 
V

Vadym Stetsyak

Hello, Ian!

What thread count do you observe or how many connections are there?
How much memory server consumes?
Are these newly spawned threads with clients socket correctly disposed?

Also you can create stress tests ( connecting with great number of sockets on the
server ) and observe server resources count ( handles ) behavior ( increase/decrease ).

While stress testing you can use some profiling tool ( e.g. ClrProfiler ) to see what objects are not
properly disposed or not GCed.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
G

Guest

Hello Vadym,

Thanks for your reply.

At the time of the crash the number of threads is at 1607. When the
application is started the number of threads is at approx 950. This is an
increase of around 65%. Other handle types (e.g. event, Mutex) also increase
by that amount during the time that the system is running.

The threads are spawned via Socket.BeginAccept callback.

We have tried to reproduce the problem via some stress tests but have failed
to do so to date. I will try using ClrProfiler to see if we can get any more
information from the live application.

Thanks
Ian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top