tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Kern/41566, Problem with pty(4) handling under NetBSD-5 filed.



On Thu, 11 Jun 2009, Brian Buhrow wrote:

>       Hello. I've not seen any responses on this message from anyone.  Is
> there anyone who might be able to help me troubleshoot this problem?
> I think I need to get down in the kernel and find out why things come to a
> halt, but I'm not sure I understand things in there enough to find this
> particular problem.  My test program is easy to run on any system, and so I
> think the problem should be easily reproduced.  This bug turns out to be a
> critical one for me, and I'm very interested in getting it fixed.  Any help
> anyone might be able to offer would be greatly appreciated.

I can at least confirm that the issue is still present in -current. I
tried your program and it doesn't always hang (I had one session going for
10 minutes) but when it does hang it seems that there are quite a few
writes in a row before some reads, leading me to guess that it happens
because the buffer becomes full and the write is blocked but the read does
not cause an unblock.

The kern/tty_pty.c file contains pts*() and ptc*() functions which are for
the slave and master (controller) respectively. That would mean that you
are being blocked in ptcwrite() but not woken by ptsread(). I tried to
verify that but my ddbfu is not great ("bt/tl 0t672" just gave me a
supervisor trap segfault?)

The "ttyraw" state is when the cv_wait is on "t_rawcv" (from kern/tty.c)
and ptcwrite() contains cv_wait_sig(&tp->t_rawcv, &tty_lock) which is
where it probably is.

Now, it seems that ptsread() does call ptcwakeup(tp, FWRITE); at the end,
but ptcwakeup() does cv_broadcast(&tp->t_rawcvf) which is not the right
condvar.

I don't know which condvar ought to be used, perhaps somebody else can
advise?

iain


Home | Main Index | Thread Index | Old Index