Subject: kern/33288: LWP stuck in lwpwait state
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <g.mcgarry@ieee.org>
List: netbsd-bugs
Date: 04/18/2006 20:25:00
>Number:         33288
>Category:       kern
>Synopsis:       LWP stuck in lwpwait state
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 18 20:25:00 +0000 2006
>Originator:     Gregory McGarry
>Release:        NetBSD-3.0
>Organization:
>Environment:
NetBSD/i386 - single-CPU machine
>Description:
Two threads with a mutex scheme using _lwp_suspend(2) and _lwp_continue(2) to schedule access to the mutex.  Hitting ^C to terminate the process causes a deadlock.  Here is the output of ps awx -s nlwps

 UID   PID  PPID CPU LID NLWP PRI NI VSZ   RSS WCHAN    STAT TTY       TIME COMMAND
1000 22714 28925   0   2    2  28  0 224   600 -        U    ttyp0  0:00.02 ./test 
1000 22714 28925   0   1    2  10  0 224   600 lwpwait  I    ttyp0  0:00.02 ./test

Attaching to the process using gdb is also futile.
>How-To-Repeat:

>Fix: