Orphan Threads

Giganews Newsgroups
Subject: Orphan Threads
Posted by:  Axel Foley (axelfoley@gmx.[hatespam].net)
Date: Fri, 22 Aug 2003

Hi, I have a problem with Indy 9.00.14 and Delphi 7, regarding threads.

We have a multithreaded server application wich is based on IdTCPServer. We
have developed a client application that connects to the server and
exchanges data with a custom protocol. We had at first what seemed "random"
orphan threads that stole all the cpu time (CPU 100%), so we decided to
debug a little and we found out that could easily reproduce the problem by
doing very fast connects/disconnects (in the order of 100-200 msec. from
the disconnect to the next connect) from the client application.

Often a thread that first was assigned by the listener to serve a client
connection doesn't get terminated after that client disconnects and
sometimes I have threads created by the listener which are not associated
for which the application didn't seem to receive any connection request.

I read that some people have had strange problems with threads, but I seem
to be the only one that, apart that problem, also has this 100% CPU time.

Tonight I tried using the Pooled thread manager but with little benefit. I
can easily reproduce the problem by overcharging the Server application
with multiple and fast connection/disconnection requests from one client.

If I connect and disconnect "normally", with some delays between the two
phases everything is ok, at least so it seems.

The problem appeared with 9.00.03 and we upgraded to 9.00.14 but with no
benefit.

Thanks for any help you can give me.

P.S.: sorry for crossposting this also here, but I guessed that few users
read the *.threads.general newsgroup.

Replies