This is the mail archive of the
glibc-bugs@sources.redhat.com
mailing list for the glibc project.
[Bug nptl/784] New: pthread_join causes a segmentation fault when it is called in catch block
- From: "xogusgalaxy at yahoo dot co dot kr" <sourceware-bugzilla at sources dot redhat dot com>
- To: glibc-bugs at sources dot redhat dot com
- Date: 11 Mar 2005 02:38:11 -0000
- Subject: [Bug nptl/784] New: pthread_join causes a segmentation fault when it is called in catch block
- Reply-to: sourceware-bugzilla at sources dot redhat dot com
I've found the pthread_join() function seems to cause a segmentation fault when
one thread throws an exception and the other thread waits for its termination
in
its own catch block.
This is a simple source code.
#include <pthread.h>
void* thread1(void* arg) {
try {
/* Throw an exception and terminate this thread.*/
throw 1;
} catch (...) {
}
}
int main(int argc, char* argv[]) {
pthread_t tid = 0;
try {
pthread_create(&tid, NULL, thread1, 0);
throw 1; // Throw an exception
} catch (...) {
/* Wait for child thread's termination in catch block. */
if (tid)
pthread_join(tid, NULL); // This causes segmentation fault.
}
return 0;
}
Here is my g++ version that compiled the source code.
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
Backtrace of core file:
#0 0x400aed0f in __cxa_end_catch () from /usr/lib/libstdc++.so.5
#1 0x080486d2 in main (argc=1, argv=0xbfffda74) at main.cpp:19 <--
pthread_join
#2 0x42015504 in __libc_start_main () from /lib/tls/libc.so.6
--
Summary: pthread_join causes a segmentation fault when it is
called in catch block
Product: glibc
Version: unspecified
Status: NEW
Severity: critical
Priority: P1
Component: nptl
AssignedTo: drepper at redhat dot com
ReportedBy: xogusgalaxy at yahoo dot co dot kr
CC: glibc-bugs at sources dot redhat dot com
http://sources.redhat.com/bugzilla/show_bug.cgi?id=784
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.