From sec@yoda.fwe.pi.musin.de  Tue Feb 15 04:15:33 2000
Return-Path: <sec@yoda.fwe.pi.musin.de>
Received: from yoda.fwe.pi.musin.de (yoda.fwe.pi.musin.de [194.246.250.18])
	by builder.freebsd.org (Postfix) with ESMTP id 3148742D5
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 15 Feb 2000 04:15:32 -0800 (PST)
Received: by yoda.fwe.pi.musin.de (Postfix, from userid 4242)
	id B6DE8382; Tue, 15 Feb 2000 13:15:50 +0100 (CET)
Message-Id: <20000215121550.B6DE8382@yoda.fwe.pi.musin.de>
Date: Tue, 15 Feb 2000 13:15:50 +0100 (CET)
From: sec@yoda.fwe.pi.musin.de
Reply-To: sec@yoda.fwe.pi.musin.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: rpc.rstatd from inetd sig11's
X-Send-Pr-Version: 3.2

>Number:         16726
>Category:       bin
>Synopsis:       rpc.rstatd from inetd sig11's
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 15 04:20:00 PST 2000
>Closed-Date:    Thu Jul 11 10:18:30 PDT 2002
>Last-Modified:  Thu Jul 11 10:18:30 PDT 2002
>Originator:     Stefan `Sec` Zehl
>Release:        FreeBSD 3.4-STABLE i386
>Organization:
>Environment:

Reasonably recent 3.4-STABLE:

FreeBSD yoda 3.4-STABLE FreeBSD 3.4-STABLE #1: Tue Jan 18 17:55:37 CET 2000     root@:/usr/src/sys/compile/YODA  i386

>Description:

I have 'xsysstats' running, which monitors machines via the rcp.rstatd

rpc.rstatd is started via inetd:

yoda:~>grep rstatd /etc/inetd.conf
rstatd/1-3      dgram rpc/udp wait root /usr/libexec/rpc.rstatd  rpc.rstatd

every now when I start xsysstats i get the following in /var/log/messages:

Feb 15 12:51:22 yoda inetd[194]: /usr/libexec/rpc.rstatd[59201]: exit status 0xb
Feb 15 12:51:22 yoda /kernel: pid 59202 (inetd), uid 0: exited on signal 11
Feb 15 12:51:22 yoda inetd[194]: /usr/libexec/rpc.rstatd[59202]: exit status 0xb
Feb 15 12:51:22 yoda /kernel: pid 59203 (inetd), uid 0: exited on signal 11
Feb 15 12:51:22 yoda inetd[194]: /usr/libexec/rpc.rstatd[59203]: exit status 0xb
Feb 15 12:51:22 yoda /kernel: pid 59204 (inetd), uid 0: exited on signal 11
Feb 15 12:51:23 yoda inetd[194]: /usr/libexec/rpc.rstatd[59204]: exit status 0xb
Feb 15 12:51:23 yoda /kernel: pid 59205 (inetd), uid 0: exited on signal 11
Feb 15 12:51:23 yoda inetd[194]: /usr/libexec/rpc.rstatd[59205]: exit status 0xb
Feb 15 12:51:23 yoda /kernel: pid 59206 (inetd), uid 0: exited on signal 11
Feb 15 12:51:23 yoda inetd[194]: /usr/libexec/rpc.rstatd[59206]: exit status 0xb
Feb 15 12:51:23 yoda inetd[194]: rstatd/udp server failing (looping), service terminated

If I then start "/usr/libexec/rpc.rstatd" as root from the shell, everything
works fine.

>How-To-Repeat:

	

enable rpc.rstatd in inetd.conf, kill -HUP inetd
install /usr/ports/sysutils/xsysstats
and start it like this:

xsysstats -allnames -split 1x3 -display :0.0  -window 1  -type cpu@yoda -color "blue" -window 2  -type disk@yoda -color "blue" -window 3  -type pkts@yoda -color "blue" -samescale -geometry 300x10-0-4 &

(just an example, s/yoda/<your_machine>/)


>Fix:
	
(workaround) Start rpc.rstatd by hand, and not from inetd.

>Release-Note:
>Audit-Trail:

From: Stefan `Sec` Zehl <sec@yoda.fwe.pi.musin.de>
To: Jonathan Chen <jon@FreeBSD.org>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: bin/16726: rpc.rstatd from inetd sig11's
Date: Tue, 11 Sep 2001 13:57:30 +0200

 On Mon, Aug 13, 2001 at 12:52:49PM -0400, Jonathan Chen wrote:
 > I can't reproduce this on my -STABLE or -CURRENT boxes.  Can you confirm 
 > whether this is still a problem on more recent versions of FreeBSD?
 
 I just had a different but similar problem with rpc.rstatd (filed as
 bin/30484)
 
 I just remembered your mail on this topic. And sure, your patch fixes
 all my problems. the "kvm_close" seems to fix the too many open files
 problem in standalone mode (see the other PR) and with this patch the
 version started from inetd runs fine, too.
 
 > If you are still running 3.x, or if this is still a problem, can you try 
 > the following patch and see if it fixes things?
 
 So I'd be happy to see this patch go into 4.x
 
 I will test this on my 3.x box shortly and report back for that one.
 
 > Index: rstat_proc.c
 > ===================================================================
 > RCS file: /export/ncvs/src/libexec/rpc.rstatd/rstat_proc.c,v
 > retrieving revision 1.14
 > diff -u -r1.14 libexec/rpc.rstatd/rstat_proc.c
 > --- libexec/rpc.rstatd/rstat_proc.c	1999/08/28 00:09:54	1.14
 > +++ libexec/rpc.rstatd/rstat_proc.c	2001/08/03 00:12:15
 > @@ -115,6 +115,7 @@
 >  {
 >      stat_is_init = 1;
 >      setup();
 > +    alarm(0);
 >      updatestat();
 >      (void) signal(SIGALRM, updatestat);
 >      alarm(1);
 > @@ -203,6 +204,7 @@
 >  #ifdef DEBUG
 >                  fprintf(stderr, "about to closedown\n");
 >  #endif
 > +		kvm_close(kd);
 >                  if (from_inetd)
 >                          exit(0);
 >                  else {
 
 
 CU & Thanks,
     Sec
 -- 
 Komme wieder
State-Changed-From-To: open->closed 
State-Changed-By: alfred 
State-Changed-When: Thu Jul 11 10:18:13 PDT 2002 
State-Changed-Why:  
patch has been applied to both -current and 4.x, thank you. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=16726 
>Unformatted:
