From nobody@FreeBSD.org  Fri Oct  7 00:36:41 2005
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 2213016A41F
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 Oct 2005 00:36:41 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id D917943D46
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  7 Oct 2005 00:36:40 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id j970aerZ039762
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 7 Oct 2005 00:36:40 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id j970aedW039761;
	Fri, 7 Oct 2005 00:36:40 GMT
	(envelope-from nobody)
Message-Id: <200510070036.j970aedW039761@www.freebsd.org>
Date: Fri, 7 Oct 2005 00:36:40 GMT
From: kapil <kapiltj@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: telnet hang in ptcout
X-Send-Pr-Version: www-2.3

>Number:         87022
>Category:       bin
>Synopsis:       telnet(1) hang in ptcout
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 07 00:40:12 GMT 2005
>Closed-Date:    
>Last-Modified:  Thu May 01 07:08:21 UTC 2008
>Originator:     kapil
>Release:        4.11
>Organization:
>Environment:
4.11-RELEASE-p10
>Description:
              If some characters and a cntrl C is entered on a telnet session before the child for slave tty is forked, the ptyflush will hang on write call, since slave tty is not open and will just wait there.
>How-To-Repeat:
              An easy way to reproduce this problem is: set connection limit on telnet to 1 (using inetd.conf). 
Connect the 1st and 2nd session. 2nd session will not show the login prompt. Here enter one or more characters and then ctrl C. Now exit the 1st session. The second sessions telentd is spawned but hangs on ptcout. Even if you exit the session, no more telnet sessions are allowed (unless connection limit is increased or telentd is killed)
>Fix:
              One fix is to not call interrupt/ptyflush unless the slave tty has been opened.
In the kernel, probably there should be a way to awaken the sleeping process once the connection goes away. It doesn't seem to be.
>Release-Note:
>Audit-Trail:

From: kapil jain <kapiltj@yahoo.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/87022: telnet hang in ptcout
Date: Thu, 6 Oct 2005 18:17:03 -0700 (PDT)

 Doing this in kernel is probably not feasible.
 Another solution is to make the pty non-blocking much
 earlier.
 
 thanks
 kapil
>Unformatted:
