BSD pty problems

Mitch Bunnell mitch at lynx.uucp
Thu Aug 24 08:02:42 AEST 1989



	I found an interesting "bug" having to do with pseudo ttys under
	4.3 BSD Unix.  Actually it is a deadlock situation that effects
	all ttys on the system.  I discovered this problem on an Integrated
	Solutions, and I am interested to find out if other Unix systems
	exhibit the same behavior.

	The problem is that if a psuedo tty has its echo enabled and the
	process with the master end of the psuedo tty open does not read from
	it but only writes, all character buffers on the system will
	eventually be used up.  This causes a deadlock because all ttys
	real and virtual cannot receive any characters.  No one on the system
	can type the command to kill the offending processes.

	Here are the commands I have found that cause the problem to occur:

	sleep 100 < /dev/ttyp5 > /dev/null &

	cat /etc/termcap > /dev/ptyp5 &

	stty echo > /dev/ttyp5

	cat /dev/ttyp5 &


	The purpose for the "sleep 100" is to keep the slave end of
	the pseudo tty from being closed so the stty that enables echo will
	not close out the pseudo tty.  The defualt setting of a speudo tty
	is no echo.  Any large amount of data can be sent to the master
	end of the psuedo tty; a cat of termcap was enogh on the I.S..
	Since the system wide character buffers are many Kbytes, it takes
	a while for the deadlock to take effect.

	If these commands have the same effect on your system as mine, you
	may have to reboot to do anything on the system after the deadlock
	occurs.  If your system is on a network you can stop the deadlock
	without having to reboot.

---------------

Mitch Bunnell - Lynx Real-time systems
mitch at lynx. voice - (408) 370-2233


Robot: "They will never believe that it is the real amulet."

Dr. Smith: "Of course they will. These naive aliens will believe anything."



More information about the Comp.unix.wizards mailing list