From nobody@FreeBSD.ORG Tue Nov 16 17:26:16 1999
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id C667414F9B; Tue, 16 Nov 1999 17:26:16 -0800 (PST)
Message-Id: <19991117012616.C667414F9B@hub.freebsd.org>
Date: Tue, 16 Nov 1999 17:26:16 -0800 (PST)
From: bruce@engmail.uwaterloo.ca
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@freebsd.org
Subject: "more" eating up CPU on users with shell=/bin/sh if telnetd disconnects
X-Send-Pr-Version: www-1.0

>Number:         14932
>Category:       misc
>Synopsis:       "more" eating up CPU on users with shell=/bin/sh if telnetd disconnects
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 16 17:30:00 PST 1999
>Closed-Date:    Sat May 13 06:59:40 PDT 2000
>Last-Modified:  Sat May 13 07:01:18 PDT 2000
>Originator:     Bruce Campbell
>Release:        3.3 RELEASE
>Organization:
University of Waterloo
>Environment:
FreeBSD elsinore.uwaterloo.ca 3.3-RELEASE FreeBSD 3.3-RELEASE #0: Thu Sep 16 23:
40:35 GMT 1999     jkh@highwing.cdrom.com:/usr/src/sys/compile/GENERIC  i386

>Description:
On 3.3 RELEASE, on a user with login shell of /bin/sh,
if a user runs "more /etc/passwd" (or something) and then
has their /bin/sh or telnetd killed (either manually with
kill -9 or if the telnetd keepalive mechanism terminates a
disconnected connection) "more" starts spinning, and quickly goes to
the top of "top", eating 50% CPU or more

>How-To-Repeat:
set login shell = /bin/sh
login
type
  more /etc/passwd
walk away after one screenful, go to another terminal, from
root determine their parent /bin/sh or telnetd, and kill
it with SIGKILL.  Run "top" and see "more" chugging

Problem is repeatable on 3 different boxes, and I received a
response from offsite from Douglas Hedges <hedges@atlantic.edu>
who repeated the problem on 3.3R.  Also had feedback from offsite from
Sheldon Hearn <sheldonh@uunet.co.za> who tried 3.3 STABLE and could
*not* repeat the problem.
>Fix:
2 fixes known...

 - use login shell = /bin/csh
 - use 3.1 RELEASE

>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: bruce@engmail.uwaterloo.ca
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/14932: "more" eating up CPU on users with shell=/bin/sh if telnetd disconnects 
Date: Wed, 17 Nov 1999 12:53:08 +0200

 On Tue, 16 Nov 1999 17:26:16 PST, bruce@engmail.uwaterloo.ca wrote:
 
 > On 3.3 RELEASE, on a user with login shell of /bin/sh, if a user
 > runs "more /etc/passwd" (or something) and then has their /bin/sh
 > or telnetd killed (either manually with kill -9 or if the telnetd
 > keepalive mechanism terminates a disconnected connection) "more"
 > starts spinning, and quickly goes to the top of "top", eating 50% CPU
 > or more
 
 Hi Bruce,
 
 As per my message sent earlier, please test with with 3.3-STABLE.
 I can't reproduce the problem with 3.3-STABLE, and if a problem in
 3.3-RELEASE doesn't exist in 3.3-STABLE, there's nothing we can do about
 it now.
 
 Also, note that the problem is not that more "eats up CPU" -- I'm pretty
 sure it's just spinning on input, so if the system got busier, you'd
 probably find that the CPU usage of the more processes would flatten
 out.
 
 The problem is simply that the children of the shell process should die
 when you kill the shell.
 
 Ciao,
 Sheldon.
 

From: Bruce Campbell <bruce@engmail.uwaterloo.ca>
To: freebsd-gnats-submit@freebsd.org, bruce@engmail.uwaterloo.ca
Cc:  
Subject: Re: misc/14932: "more" eating up CPU on users with shell=/bin/sh if 
 telnetd disconnects
Date: Fri, 19 Nov 1999 13:42:01 -0500

 The problem persists on 3.3 STABLE from Nov 17.   Our e-mail server,
 which is heavily loaded regularly (load average 5-10
 quite often), is pushed over the edge once a few "more" processes start
 spinning, and the load average can climb to
 20 or 30, rendering the e-mail server unuseable for all practical
 purposes.
 
 On our test machine that we upgraded to 3.3 STABLE, the source for
 /bin/sh is unchanged from 3.3 RELEASE.
 
 The source for /usr/bin/more has a number of changed files on Nov 17.
 
 Results on test machine...
 
 # uname -a
 FreeBSD elsinore.uwaterloo.ca 3.3-STABLE FreeBSD 3.3-STABLE #0: Thu Nov
 18 13:36:03 EST 1999
 root@elsinore.uwaterloo.ca:/usr/src/sys/compile/ELSINORE  i386
 
 # ps waux | grep junk
 root    11183  0.0  1.3   876  380  p6  D+    1:03PM   0:00.01 grep junk
 
 junk    11177  0.0  0.9   500  256  p5  Ss    1:02PM   0:00.03 -sh (sh)
 junk    11178  0.0  1.8   860  508  p5  S+    1:02PM   0:00.01 more
 /etc/passwd
 
 # kill -KILL 11177
 # !ps
 ps waux | grep junk
 junk    11178  7.1  1.7   860  492  p5- R     1:02PM   0:01.61 more
 /etc/passwd
 #
 
 "top" outout...
 
   PID USERNAME PRI NICE  SIZE    RES STATE    TIME   WCPU    CPU COMMAND
 
 11178 junk     100   0   860K   492K RUN      7:21 98.97% 98.97% more
 
 
 

From: Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To: bruce@engmail.uwaterloo.ca
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/14932: "more" eating up CPU on users with shell=/bin/sh if telnetd disconnects
Date: Tue, 9 May 2000 00:12:44 -0400

 On Tue, Nov 16, 1999 at 05:26:16PM -0800, bruce@engmail.uwaterloo.ca wrote:
 > 
 > >Description:
 > On 3.3 RELEASE, on a user with login shell of /bin/sh,
 > if a user runs "more /etc/passwd" (or something) and then
 > has their /bin/sh or telnetd killed (either manually with
 > kill -9 or if the telnetd keepalive mechanism terminates a
 > disconnected connection) "more" starts spinning, and quickly goes to
 > the top of "top", eating 50% CPU or more
 
 I've fixed more to exit after it reads two EOFs, but the more serious
 problem here, of course, is that /bin/sh isn't propogating signals
 correctly.
 
 The updated more is in -current and 4-stable.  I'm not sure if I'll
 merge it all the way back to 3-stable unless you need it there.  Being
 from the evil university, you'd have to ask really really nicely...  ;-)
 
 
 -- 
 Signature withheld by request of author.
 
State-Changed-From-To: open->closed 
State-Changed-By: hoek 
State-Changed-When: Sat May 13 06:59:40 PDT 2000 
State-Changed-Why:  
Appears fixed in all current versions of FreeBSD. 
>Unformatted:
