Subject: kern/29652: netbsd on MP crashes w/ pthread apps and PTHREAD_CONCURRENCY>=2
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <skrueger@meinberlikomm.de>
List: netbsd-bugs
Date: 03/10/2005 14:41:00
>Number:         29652
>Category:       kern
>Synopsis:       netbsd on MP crashes w/ pthread apps and PTHREAD_CONCURRENCY>=2
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 10 14:41:00 +0000 2005
>Originator:     Stefan Krüger
>Release:        NetBSD 2.99.16
>Organization:
>Environment:
...
>Description:
As written in <422CBD1E.6060007@meinberlikomm.de>:

anyway, I figured out how to (reproduceable!) panic a fresh netbsd
kernel (build today, from HEAD), with ogg123 but any other pthread app
may trigger it, too :(

again, I have a MP box and this only happens with PTHREAD_CONCURRENCY>=2

panic: kernel diagnostic assertion "p->p_nrlwps == 0" failed: file
"/usr/src/sys/kern/kern_exit.c", line 781
Stopped in pid 30.1 (csh) at netbsd:cpu_Debugger+0x4:      popl     %ebp
db{0}> bt
cpu_Debugger(c02b0062,c47cfec0,206,c031de80,c02d4cc0) at
netbsd:cpu_debugger+0x4

panic(c02f5280,c02b0def,c02b495f,c02d4800,30d) at netbsd:panic+0xb5
__assert(c02b0def,c02d4800,30d,c02b495f,0) at netbsd:__assert+0x2e
proc_free(c3e4cab4,bfbfe7e8,48,c47cff40,0) at netbsd:proc_free+0x81
sys_wait4(c3e4b6b4,c47cff70,c47cff68,c031daa8,c02fa834) at
netbsd:sys_wait4+0xf5

syscall_plain() at netbsd:syscall_plain+0x10f
--- syscall (number 7) ---
0xbdb3893f
db{0}> sync

I also got a crashdump but the netbsd.?.core is somehow damaged, I've
tried it several times with no luck :-(
>How-To-Repeat:
boot -s (you don't want to trash your fs, right? :-))
$ mount -r /home (ogg file is saved there)
$ mount -r /usr
$ mount -r /usr/pkg
$ su -m ordinary_user
% env PTHREAD_CONCURRENCY=2 ogg123 song.ogg (let it play a few secs)
CRTL+Z
% fg
CRTL+C
>Fix:
yes please :-)