i386/128265: deadlock in pthread_create occurs in case if any C++
exception was thrown and succesfully catched
Dmitry Moskalchuk
d.moskalchuk at drweb.com
Tue Oct 21 10:30:01 UTC 2008
>Number: 128265
>Category: i386
>Synopsis: deadlock in pthread_create occurs in case if any C++ exception was thrown and succesfully catched
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: freebsd-i386
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Oct 21 10:30:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Dmitry Moskalchuk
>Release: 7.0-STABLE
>Organization:
DrWeb
>Environment:
FreeBSD freebsd70s.i.drweb.ru 7.0-STABLE FreeBSD 7.0-STABLE #0: Fri Aug 22 22:54:27 MSD 2008 root at freebsd70s.i.drweb.ru:/usr/obj/usr/src/sys/GENERIC i386
>Description:
There is an error either in the GNU C++ library or in the pthread_create implementation: in case if any C++ exception was thrown and succesfully catched all "pthread_create" calls causes dead-lock.
>How-To-Repeat:
Just build and run the minimal example:
////// test.cpp
#include <iostream>
#include <pthread.h>
void *thread(void *arg)
{
std::cout << "Thread" << std::endl;
}
void conditional_throw(bool arg)
{
if(arg)
throw "Exception";
}
int main(int argc, char *argv[])
{
std::cout << "Start" << std::endl;
try { conditional_throw(argc > 1 && ::strcasecmp(argv[1], "freeze") == 0); }
catch(...) {}
std::cout << "Create thread" << std::endl;
pthread_t tid;
int ret = ::pthread_create(&tid, 0, &thread, 0);
if(ret != 0)
return 1;
::sleep(1);
std::cout << "Stop" << std::endl;
return 0;
}
//// end of test.cpp
You'll need to run it with command-line parameter "freeze" to get deadlock.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-i386
mailing list