Subject: bin/4056: excess sleep(1) in inetd
To: None <gnats-bugs@gnats.netbsd.org>
From: David Holland <dholland@bordeaux.eecs.harvard.edu>
List: netbsd-bugs
Date: 08/28/1997 20:43:34
>Number: 4056
>Category: bin
>Synopsis: missing {} in inetd lead to excess sleep(1)s
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people (Utility Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Aug 29 01:50:02 1997
>Last-Modified:
>Originator: David A. Holland <dholland@eecs.harvard.edu>
>Organization:
- David A. Holland | VINO project home page:
dholland@eecs.harvard.edu | http://www.eecs.harvard.edu/vino
>Release: NetBSD-current of 19970828
>Environment:
System: NetBSD bordeaux 1.2C NetBSD 1.2C (BORDEAUX.PROF) #28: Sat Mar 1 16:28:54 EST 1997 abrown@bordeaux:/usr/src/sys/arch/i386/compile/BORDEAUX.PROF i386
The bug was actually found on other platforms and found to affect netbsd.
>Description:
There's a {} missing around an if that checks for select failing with
EINTR. The consequence of this is that inetd does a sleep(1) every time
it receives a signal while in select().
This has an unfortunate effect on performance.
>How-To-Repeat:
>Fix:
--- inetd.c.old Thu Aug 28 07:06:31 1997
+++ inetd.c Thu Aug 28 07:10:34 1997
@@ -386,11 +386,12 @@
}
readable = allsock;
if ((n = select(maxsock + 1, &readable, (fd_set *)0,
(fd_set *)0, (struct timeval *)0)) <= 0) {
- if (n < 0 && errno != EINTR)
+ if (n < 0 && errno != EINTR) {
syslog(LOG_WARNING, "select: %m");
- sleep(1);
+ sleep(1);
+ }
continue;
}
for (sep = servtab; n && sep; sep = sep->se_next)
if (sep->se_fd != -1 && FD_ISSET(sep->se_fd, &readable)) {
>Audit-Trail:
>Unformatted: