From owner-freebsd-bugs Thu Aug 2 17:30: 7 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E7CDD37B401 for ; Thu, 2 Aug 2001 17:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f730U1G66876; Thu, 2 Aug 2001 17:30:01 -0700 (PDT) (envelope-from gnats) Date: Thu, 2 Aug 2001 17:30:01 -0700 (PDT) Message-Id: <200108030030.f730U1G66876@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Jonathan Chen Subject: Re: bin/24857: File descriptor leak and frequent crashes of rpc.rstatd [PATCH] Reply-To: Jonathan Chen Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/24857; it has been noted by GNATS. From: Jonathan Chen To: freebsd-gnats-submit@FreeBSD.org, mb@bagheera.thgwf.de Cc: Subject: Re: bin/24857: File descriptor leak and frequent crashes of rpc.rstatd [PATCH] Date: Thu, 2 Aug 2001 20:20:40 -0400 > However, when run standalone, it crashed frequently, and I also > discovered a file descriptor leak. > > I have observed that: > > 1) rpc.rstatd opens /dev/mem and /dev/kmem multiple times > until running out of file descriptors. > 2) rpc.rstatd often crashes within 24 hours The following patch is what I've applied to -CURRENT. It simplifies what you have to fix (1) and more correctly fixes (2) (your code still allows a small window where the problem can still occur). Please test it out. To crash rpc.rstatd, I used something similar to the following: rup localhost & ; rup localhost & ;rup localhost & ;rup localhost & ;[repeat] Index: rstat_proc.c =================================================================== RCS file: /export/ncvs/src/libexec/rpc.rstatd/rstat_proc.c,v retrieving revision 1.14 diff -u -r1.14 rstat_proc.c --- rstat_proc.c 1999/08/28 00:09:54 1.14 +++ 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 { To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message