From: Tim Laplaca (tlaplaca_at_[hidden])
Date: 2004-11-29 13:57:00
I went ahead and submitted a bug report in the Sourceforge bug tracker
for this issue:
[ 1075456 ] Boost::thread under Linux crashes after 200 to 400 threads
I made it a high priority, since it's a program crash. I attached my
program to reproduce the problem, so hopefully the person who fixes this
will be able to reproduce the crash pretty easily.
[mailto:boost-bounces_at_[hidden]] On Behalf Of Tim Laplaca
Sent: Monday, November 29, 2004 9:29 AM
Subject: RE: [boost] Thread: Why is my prog aborting after 283 or so
Thanks for the link.
I'm not sure it applies though; the prog isn't spawning the threads
simultaneously, so it shouldn't be taking many resources. I've found
that even if I only have one thread spawned at one time (where the
previous thread has died out before the new one is spawned) it still
aborts at the same place.
Over the holiday I pared my program down to just the thread spawning,
and on my Mandrake setup at home it dies at the nice even (computer)
number of 256 threads. The same pared-down prog dies on my work Fedora
Core 3 machine at 405. Under Windows, it doesn't ever seem to die.
I'm getting pretty convinced this is a bug in the boost library that
manifests itself only under Linux, and not my code. Perhaps resources
are not being properly released when the threads are dying out.
Since the prog is pretty small, I'll include it here. It spawns a
thread every second, and each thread only last one second.
// for multithreading
int totalthreads = 0;
boost::mutex io_mutex; // iostreams
boost::mutex numthreads_mutex; // for changing value of numthreads
boost::mutex threadid_mutex; // for manipulating thread_id
using namespace std;
// wait some secs
xt.sec += 1;
std::cout << " Thread Exiting. " << std::endl;
// Main thread-spawning loop
for (int i=0; i<=maxthreads; i++)
std::cout << "MAIN: Thread:" << totalthreads << " being
// wait some seconds
xt.sec += 1;
} // end thread-spawning for loop
std::cout << "Done." << std::endl;
Here's the Makefile I build it with:
lib = /usr/local/lib/libboost_thread-gcc-mt-1_32.so
threadtest : threadtest.o
g++ $(lib) $(lib2) -o threadtest threadtest.o -ldl -lc -lpthread
threadtest.o : threadtest.cpp
g++ -Wall threadtest.cpp -I/usr/local/include/boost-1_32
-pthread -c -w -O -o threadtest.o
[mailto:boost-bounces_at_[hidden]] On Behalf Of Alexander Nasonov
Sent: Friday, November 26, 2004 2:07 PM
Subject: Re: [boost] Thread: Why is my prog aborting after 283 or so
Tim Laplaca wrote:
> I wrote a prog that spawns threads (RED HAT Fedora Core 2), and after
> spawning 283 or so threads, it stops running and 'Aborted' is printed.
Take a look at: http://www.kegel.com/c10k.html#threaded
and check your sizes.
-- Alexander Nasonov _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk