Red Hat Bugzilla – Bug 66314
gcc 2.96 compiled program crashes on SMP machine
Last modified: 2007-04-18 12:43:02 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.0) Gecko/20020530
Description of problem:
The attached program performs multithreading via the ZThread library
(http://zthread.sourceforge.net/). It works stable on single processor machines
but always crashes on dual processor machines. The backtrace is always the same,
it crashes in the STL streambuf class.
When I use gcc 3.1 to compile ZThread and the program, everything works stable,
even on SMP machines.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Download and compile ZThread (preferrably 2.1.x) library (i.e. ./configure, make)
2.Edit and run compile.sh
3.Run the executable
Actual Results: The program segfaults on dual processor machines but is stable
on single processor machines.
Expected Results: Should run stable.
Backtrace from segfault:
#0 0x401555dc in _IO_default_xsputn (f=0xbe1ff950, data=0x804f03c,
n=134549856) at genops.c:466
#1 0x400a1bc3 in streambuf::xsputn () from /usr/lib/libstdc++-libc6.2-2.so.3
#2 0x4009e8dc in ostream::write () from /usr/lib/libstdc++-libc6.2-2.so.3
#3 0x0804b8cb in ostream & operator<<<char, string_char_traits<char>,
__default_alloc_template<true, 0> > ()
#4 0x0804b3b9 in Log::WriteStream ()
#5 0x0804b481 in endLog ()
#6 0x0804db95 in MyThread::run ()
#7 0x4004d7a8 in ZThread::ThreadImpl::dispatch ()
#8 0x4005681e in _dispatch ()
#9 0x40219f87 in pthread_start_thread (arg=0xbe1ffc00) at manager.c:284
Created attachment 60024 [details]
program and shell script to compile it
This problem is still happening - also in the stream and stringstream
Is gcc2.96 not thread-safe?
Indeed, gcc 2.96 libstdc++ was not thread safe. But that aside, current
thread-safe versions are tied to pthreads, and so would not have worked
with a third-party thread library.
Closing as CURRENTRELEASE, as it seems that the main complaint was vs