Subject: Re: kern/32682: netbsd-3 ptyfs intermittent failure with Matlab
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Hauke Fath <hf@spg.tu-darmstadt.de>
List: netbsd-bugs
Date: 02/08/2006 16:00:04
The following reply was made to PR kern/32682; it has been noted by GNATS.

From: Hauke Fath <hf@spg.tu-darmstadt.de>
To: christos@zoulas.com (Christos Zoulas)
Cc: gnats-bugs@NetBSD.org, kern-bug-people@NetBSD.org,
	gnats-admin@NetBSD.org
Subject: Re: kern/32682: netbsd-3 ptyfs intermittent failure with Matlab
Date: Wed, 8 Feb 2006 16:55:02 +0100

 I finally managed to get hold of an error instance...
 
 Ktracing Matlab 14 gave me
 
 [tj@Katzenbuckel clpois]$ kdump | less
 
 [...]
 
   25647 MATLAB   CALL  open(0xbac662e0,0x8002,0)
   25647 MATLAB   NAMI  "/emul/linux/dev/pts/5"
   25647 MATLAB   NAMI  "/dev/pts/5"
   25647 MATLAB   RET   open -1 errno -13 Permission denied
 
 
 Am 31.01.2006 um 12:52 Uhr -0500 schrieb Christos Zoulas:
 >Can you show what w(1) prints
 
 Katzenbuckel# w
   1:20PM  up 6 days,  5:46, 1 user, load averages: 1.19, 1.49, 1.59
 USER     TTY     FROM              LOGIN@  IDLE WHAT
 tj       :0      -                Thu07AM     ? /bin/sh /usr/pkg/bin/startkde
 
 >and the "interesting" ptys in /dev/[pt]ty??.
 
 [tj@Katzenbuckel clpois]$ ll /dev/pts/
 total 31
 dr-xr-xr-x  1 root wheel   512 Feb  2 07:50 ./
 drwxr-xr-x  5 root wheel 30720 Oct 23 03:27 ../
 crw-rw-rw-  1 root wheel  3, 0 Oct 22 23:25 0
 crw-rw-rw-  1 root wheel  3, 1 Feb  3 03:15 1
 crw-rw-rw-  1 root wheel  3, 2 Feb  8 07:21 2
 crw--w----  1 hf   tty    3, 3 Feb  2 11:28 3
 crw-rw-rw-  1 root wheel  3, 4 Feb  8 09:39 4
 
 >I suspect what is going on, is that you have a rogue program that is
 >opening old style pty's behind the pty subsystem's back, so when ptyfs
 >tries to open the same pty, it fails. So when it fails for pts/4 for
 >example, what does lsof say for /dev/{t,p}typ4?
 
 Is lsof tied to the OS version? I got a warning "...compiled for 
 NetBSD 2" and no output.
 
 fstat(1) gave me
 
 Katzenbuckel# fstat /dev/ttyp5
 USER     CMD          PID   FD MOUNT       INUM MODE         SZ|DV R/W NAME
 root     fstat       8778    0 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     fstat       8778    1 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     fstat       8778    2 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     tcsh       19818   15 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     tcsh       19818   16 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     tcsh       19818   17 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     tcsh       19818   18 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 root     tcsh       19818   19 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 hf       tcsh       21122   15 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 hf       tcsh       21122   16 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 hf       tcsh       21122   17 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 hf       tcsh       21122   18 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 hf       tcsh       21122   19 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 tj       bash       24622    0 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 tj       bash       24622    1 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 tj       bash       24622    2 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 tj       bash       24622  255 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 tj       kdeinit      902   20 /        1855043 crw-rw-rw-   ttyp5 rw 
 /dev/ttyp5
 Katzenbuckel# fstat /dev/ptyp5
 USER     CMD          PID   FD MOUNT       INUM MODE         SZ|DV R/W NAME
 tj       kdeinit      902   19 /        1854014 crw-rw-rw-   ptyp5 rw 
 /dev/ptyp5
 
 
 -- The latter is kind of interesting. What confused me, though, is 
 that after logging out and logging in again, Matlab did still fail 
 but an fstat for the relevant {p,t}typ? came up empty.
 
 As a further data point, a coworker who uses Gnome exclusively claims 
 he has never seen the error (most of the people here use KDE). ISTR, 
 though, that I have seen Matlab fail under XFCE4 - which is set up to 
 start the KDE and Gnome daemons. Hmmm...
 
 Anything else that I could check?
 
 	hauke
 
 
 -- 
 /~\  The ASCII Ribbon Campaign                    Hauke Fath
 \ /    No HTML/RTF in email	        Institut für Nachrichtentechnik
   X     No Word docs in email	                  TU Darmstadt
 / \  Respect for open standards              Ruf +49-6151-16-3281