[fpc-pascal] Aservia EndThread discovery

L L at z505.com
Tue Jun 17 02:08:19 CEST 2008


I found an issue in Aservia where linux was opening threads and not 
closing them.

Using OpenWebLoad or Apache Bench the server would simply hang up after 
380 requests (threads) were opened.

Sometimes using a home web server, one has less than 380 threads ever 
opened in his application over a few days.. therefore the issue isn't 
noticeable.

If EndThread() is used at the bottom of the passed in thread function, 
the problem goes away.

The fpc docs state one does not have to call EndThread, as the thread 
will disappear when the passed in function exits anyway.

I have found this isn't the case in Aservia and Linux, at least.

Has anyone experienced that issue before where a threaded application 
works for a while, then all of a sudden hangs up? Check the magic number 
"380" if so!

It may not be an issue on MS Windows because when I tested windows the 
issue did not arise as far as I remember.

After searching on google, I confirmed that "380" is indeed a magic 
number that linux uses for maximum threads.

Bug report is here:
http://bugs.freepascal.org/view.php?id=11490



More information about the fpc-pascal mailing list