[Iftop-users] Iftop 0.14 on FreeBSD 5.1 using up all the file handles?
Chris Lightfoot
chris at ex-parrot.com
Wed, 5 Nov 2003 12:48:42 +0000
On Wed, Nov 05, 2003 at 09:43:43AM +1300, Stuart Whelan - Simulation Hardware LTD wrote:
> > Hmm. Which resolver is it using? Does strace show anything
> > useful (try strace -eopen,socket iftop)? Can you use lsof or
> > similar to identify files the process has open?
>
> Hi Chris,
>
> Thanks for the prompt reply. :)
>
> Judging from the make output of the port it is using the forking
> resolver:
>
> >>checking how to call gethostbyaddr_r... no idea; dropping back to the
> forking resolver
>
> I just tried to build strace onto my system, but it is having problems,
> I will get back to you on that one.
ok... I can't reproduce this here (on Linux), so it may be
a FreeBSD issue. Could you try applying the following
patch, which will make iftop print some debugging
information from the resolver, and then running iftop with
a command line like
iftop -i whatever ... 2> iftop.log
-- and then telling me what the contents of iftop.log look
like? (Obviously you have to direct stderr into a file
since otherwise it'll mess up the display....)
diff -u -r1.18 resolver.c
--- resolver.c 6 Sep 2003 13:52:36 -0000 1.18
+++ resolver.c 5 Nov 2003 12:46:04 -0000
@@ -320,7 +320,7 @@
workerinfo = xmalloc(sizeof *workerinfo);
pthread_setspecific(worker_key, workerinfo);
workerinfo->fd = p[0];
-
+
switch (workerinfo->child = fork()) {
case 0:
close(p[0]);
@@ -332,6 +332,7 @@
return NULL;
default:
+fprintf(stderr, "New child is %d, we have fd %d, he has fd %d\n", workerinfo->child, p[0], p[1]);
close(p[1]);
}
}
@@ -340,11 +341,13 @@
if (write(workerinfo->fd, addr, sizeof *addr) != sizeof *addr
|| read(workerinfo->fd, name, NAMESIZE) != NAMESIZE) {
/* Something went wrong. Just kill the child and get on with it. */
+fprintf(stderr, "Protocol error (%s) talking to child %d\n", strerror(errno), workerinfo->child);
kill(workerinfo->child, SIGKILL);
wait();
close(workerinfo->fd);
xfree(workerinfo);
pthread_setspecific(worker_key, NULL);
+ *name = 0;
}
if (!*name)
return NULL;
--
Suburbia: where they cut down the trees then name streets after them