Date: Thu, 2 Aug 2001 17:30:01 -0700 (PDT) From: Jonathan Chen <jon@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/24857: File descriptor leak and frequent crashes of rpc.rstatd [PATCH] Message-ID: <200108030030.f730U1G66876@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/24857; it has been noted by GNATS. From: Jonathan Chen <jon@FreeBSD.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200108030030.f730U1G66876>