Subject: race condition in pthread write()?
To: Nathan J. Williams <>
From: Karl Janmar <>
List: tech-kern
Date: 02/11/2003 14:57:46
Hi Nathan,

I think there is a race condition in write()-libc or pthread, I don't
exactly where to look, but here is my case:
I run xmms with pthread, it use one thread for writing to esd, and some
others for encode the mp3-stream. After a while (could be up to 1-2 hour)
it freeze. when I do ps axs it shows that all threads(10 or something) is
stuck in sastacks (kern_sa.c:sa_uppcall_userret() waiting for a stack to
run?) and ONE is in waiting (it says wait in the WCHAN col. in ps).
When I do a backtrace on the running xmms i found this:
#0  0x4856fffb in write () from /usr/lib/
#1  0x482e5f65 in write () from /usr/lib/
#2  0x4863b8ef in get_oplugin_info ()
   from /usr/pkg/lib/xmms/Output/
#3  0x4863bbed in get_oplugin_info ()
   from /usr/pkg/lib/xmms/Output/
#4  0x1c340 in ?? ()

Ok, maybe this doesn't say too much but if you could give me a hint where
to look maybe I could help you find the problem. (I am very new to the
NetBSD kernel, and especailly the SA).

Regards, Karl Janmar