Subject: lib/34999: pthread_create crashes in pthread_sa_start
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <netbsd-gnats@plan9.de>
List: netbsd-bugs
Date: 11/06/2006 03:40:01
>Number: 34999
>Category: lib
>Synopsis: pthread_create crashes in pthread_sa_start
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 06 03:40:00 +0000 2006
>Originator: Marc Lehmann
>Release: 3.0
>Organization:
>Environment:
NetBSD wren.sqweek.dnsdojo.org 3.0 NetBSD 3.0 (GENERIC) #0: Mon Dec 19 01:04:02 UTC 2005
builds@works.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/i386/200512182024Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/i386/compile/GENERIC i386
>Description:
When running the testsuite for the perl module IO::AIO-2.2, the test t/04_fork.t reproducabily crashes in the child created.
The backtrace looks like this:
#0 0xbda0a0bb in kill () from /usr/lib/libc.so.12
#1 0xbda8b233 in abort () from /usr/lib/libc.so.12
#2 0xbdab7855 in pthread__sa_start () from /usr/lib/libpthread.so.0
#3 0xbdababb8 in pthread_init () from /usr/lib/libpthread.so.0
#4 0xbdabb089 in pthread_create () from /usr/lib/libpthread.so.0
#5 0xbd9ddcc9 in start_thread ()
from /home/sqweek/src/IO-AIO-2.2/blib/arch/auto/IO/AIO/AIO.so
Futher investigation shows that this _seems_ to be caused by this abort:
if (rr != 0 && pthread__setrrtimer(rr, 1) != 0)
abort();
Setting the environment variable PTHREAD_RRTIME to zero makes the test run without any problems.
The code hints at this having something to do with the RR interval set by the application, but the application in question (perl + IO::AIO) should not tinker with any round robin interval.
This is why I think this might be a bug in netbsd itself.
Google finds a few references to pthread__sa_start and abort and having to set PTHREAD_RRTIME to 0 to make it work, but nothing really specific and I can't find a bug report for netbsd.
>How-To-Repeat:
Download IO::AIO, e.g. from here: http://data.plan9.de/IO-AIO-2.2.tar.gz
unpack and enter it, then:
perl Makefile.PL
make test
this will run all tests with only tets 04 failing.
One cna run only that test via:
perl -Mblib t/04_fork.t
Running it like:
PTHREAD_RRTIME=0 perl -Mblib t/04_fork.t
makes the test pass (meaning it outputs ok 1 .. ok 9 without aborting in the child).
>Fix:
Set PTHREAD_RRTIME=0 when running the threaded program.