FFI: number of worker threads?

Simon Marlow simonmarhaskell at gmail.com
Wed Jun 21 07:48:42 EDT 2006


Seth Kurtzberg wrote:
> Another related question.  I have some threaded applications running
 > which are servers and run continuously.  A thread is spawned for each
 > new connection, and the thread exits when the client terminates.
> 
> I've noticed that the thread ID increases.  On one process I checked
 > today I am up to thread number 3300.  The number of running threads
 > is not increasing; only six threads are running on this particular 
process.
 > The threads are cleaned up and exit.  The thread _ID_ is continually
 > increasing.
> 
> Is this going to cause a problem when the thread ID exceeds some value?  Do I have to force the server process to recycle periodically?
> 
> These processes are designed to run continuously, and are running in a fairly demanding commercial environment for extended periods of time.  They have proven to be very stable and reliable.  I'm hopeful that it will not be necessary to recycle to force the thread ID to restart.

The thread ID assigned to new threads will wrap around when it reaches 
2147483647.  In 6.6 we made thread IDs 64 bits, so you get a bit longer 
before they wrap around.  Even if you manage to wrap the thread ID, 
it'll only be a problem if you actually compare ThreadIDs.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list