Opened 18 years ago

Closed 18 years ago

#324 closed Bugs (None)

Boost::thread under Linux crashes after 200 to 400 threads

Reported by: tlaplaca Owned by: nobody
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

Reproduced on both version 1_31 and 1_32 of Boost.
Reproduced on Mandrake Linux 10.0 and Fedora Core 2.
NOT reproducable on Windows XP (Vis C++ 7.1).

Programs generating threads with boost.thread abort
after a few hundred threads.  I do not mean concurrent
threads; this has been reproduced with a program that
never has more than one or two threads active at any
one time.  

Attached to this bug report is very short program I
wrote to demonstrate this problem.  The program
generates a thread every second, and each thread only
lasts a second.  There is never more than 1 or 2
threads active at any time.

On Mandrake 10.0 the program aborts/crashes after 256
threads.  On Fedora Core 2 it aborts after about 400
threads.  The same program built with Vis C++ 7.1 on
Win XP never seems to crash; it generated tens of
thousands of threads before I manually ended it.

Also attached is the Makefile to build the program with
g++.




Change History (3)

comment:1 by tlaplaca, 18 years ago

Logged In: YES 
user_id=1139403

Note: To reproduce the problem quickly, change the time the
threads wait before ending to 0, and also the time the main
loop waits between spawning threads to 0 as well. 
Otherwise, it will take one second per thread (which is
useful to verify the problem isn't having all the threads
open at once).

comment:2 by cepstein, 18 years ago

Logged In: YES 
user_id=36183

Not a bug.  Call pthread_join to reap child thread's stack
and exit code.

comment:3 by tlaplaca, 18 years ago

Status: assignedclosed
Logged In: YES 
user_id=1139403

cepstein is correct, I redesigned it so that main() joins
the threads as they complete, and it has spawned over a
million threads so far with no problem.  

Closed.
Note: See TracTickets for help on using tickets.