Bug 16726

Summary: rpc.rstatd from inetd sig11's
Product: Base System Reporter: sec <sec>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.4-STABLE   
Hardware: Any   
OS: Any   

Description sec 2000-02-15 12:20:00 UTC
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.

Fix: 

(workaround) Start rpc.rstatd by hand, and not from inetd.
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>/)
Comment 1 sec 2001-09-11 12:57:30 UTC
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
Comment 2 Alfred Perlstein freebsd_committer freebsd_triage 2002-07-11 18:18:13 UTC
State Changed
From-To: open->closed

patch has been applied to both -current and 4.x, thank you.