Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uunet!asp From: asp@uunet.UU.NET (Andrew Partan) Newsgroups: comp.bugs.4bsd Subject: inetd looping detection too short & dummy environ set wrong Message-ID: <73423@uunet.UU.NET> Date: 8 Dec 89 18:13:56 GMT Organization: UUNET Communications Services, Falls Church, VA Lines: 80 Subject: inetd looping detection too short & dummy environ set wrong Index: etc/inetd/inetd.c Description: 1) inetd has some loop detection code to see if some service is being invoked 'too often', and, if so, stops servicing requests for the service for a while. It detects a loop by keeping track of the number of servers it starts for each service. It does not start more than TOOMANY (40) servers in CNTY_INTVL (60) seconds. If it detects a loop, it logs "server failing (looping), service terminated". The problem is that machines are now fast enough that you may want to run more than 40 servers a minute (we did, anyhow). 2) inetd sets a dummy environment variable 'inetd_dummy' so that daemons have some space to overwrite their environment for ps. It tries to initialiaze this variable to all x's, but calculates the length of the variable wrong, so that only the 1st few bytes get set to x's. Repeat-By: 1) Try to run more than 40 services a second (like "rsh compress" of news batches to a fast machine). 2) Inspection of the source. Fix: 1) Increase the loop count from 40 to 400 (should hold us for a while - really need better loop detection code here). 2) Use the proper size of the dummy environment variable when initializing it. *** inetd.c.ORIG Fri Jan 27 12:33:18 1989 --- inetd.c Fri Dec 8 13:00:20 1989 *************** *** 79,87 **** #include #include #include ! #define TOOMANY 40 /* don't start more than TOOMANY */ #define CNT_INTVL 60 /* servers in CNT_INTVL sec. */ #define RETRYTIME (60*10) /* retry after bind or server fail */ #define SIGBLOCK (sigmask(SIGCHLD)|sigmask(SIGHUP)|sigmask(SIGALRM)) --- 79,87 ---- #include #include #include ! #define TOOMANY 400 /* don't start more than TOOMANY */ #define CNT_INTVL 60 /* servers in CNT_INTVL sec. */ #define RETRYTIME (60*10) /* retry after bind or server fail */ #define SIGBLOCK (sigmask(SIGCHLD)|sigmask(SIGHUP)|sigmask(SIGALRM)) *************** *** 224,232 **** /* space for daemons to overwrite environment for ps */ #define DUMMYSIZE 100 char dummy[DUMMYSIZE]; ! (void)memset(dummy, 'x', sizeof(DUMMYSIZE) - 1); dummy[DUMMYSIZE - 1] = '\0'; (void)setenv("inetd_dummy", dummy, 1); } --- 224,232 ---- /* space for daemons to overwrite environment for ps */ #define DUMMYSIZE 100 char dummy[DUMMYSIZE]; ! (void)memset(dummy, 'x', DUMMYSIZE - 1); dummy[DUMMYSIZE - 1] = '\0'; (void)setenv("inetd_dummy", dummy, 1); } --asp@uunet.uu.net (Andrew Partan) ASN.1 Object Identifier: "{joint-iso-ccitt mhs(6) group(6) 157}"