Threads increasing in a Http server using TIdHttpServer

Giganews Newsgroups
Subject: Threads increasing in a Http server using TIdHttpServer
Posted by:  Thomas Bergerot (
Date: Wed, 19 Dec 2007


I have a server using TIdHttpServer

I implement OnConnect, OnDisconnect, and OnCommandGet.

KeepAlive is false (server side), but could be true on client side.

In my OnConnect, i create my database objects (threadsafe),

In my OnCommandGet, i respond to the requests using
AResponseInfo.ContentType/AResponseInfo.ContentText, or using ServeFile.

in my OnDisconnect, i destroy my database objects.

It works fine with few connections, but when i do more simultaneous
connections, the process starts using a lot of ram, and i have a slowly
but increasing threads number in the process explorer of windows (i saw
it up to 270 threads, as it is impossible that i have 270 concurrent
connections !)

It looks like some of the threads are not killed.

What could be wrong ?

What could lead the threads not to be destroyed ?

Please help me, it's very annoying for me i cannot understand what's