Date: Thu, 25 Oct 2001 23:22:01 -0500 From: "Mishler, Barry A POJ" <Barry.A.Mishler@poj02.usace.army.mil> To: freebsd-net@FreeBSD.ORG Subject: Timeout on dns resolver functions Message-ID: <06F2D681CAF4774DBDD5852190A0CC213EF968@POJMAIL02.poj.usace.army.mil>
next in thread | raw e-mail | index | archive | help
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C15DD5.C23E8920 Content-Type: text/plain; charset="iso-8859-1" I'm sure this has been discussed before but I've been unable to find a proper solution... Is there a nice portable way to establish a timeout on the resolver routines? I let trafshow run for several hours when it caused a flood of 'File Table Full' syslog messages. It turns out that the trafshow code sets an alarm() before it calls gethostbyaddr and then it wraps the whole thing inside a setjmp block. When the reverse lookup takes too long, the gethostbyaddr is terminated ungracefully leaving a file descriptor open. After a while, this file descriptor leakage fills up the table. I've found that trafshow's addrtoname.c was lifted pretty much straight out of the tcpdump collection. The biggest difference is that tcpdump waits 20 seconds whereas trafshow defaults to a 2-second wait in order to keep things moving. So I can only assume that tcpdump would similarly fill up the FD table if given the chance. I don't know if this is relevant, but trafshow never leaked descriptors until I upgraded from some version of 4.0-STABLE to 4.1-RELEASE. I confirmed this on two machines. I never got around to tracking it down until recently. Sorry. So what's a portable program to do? How can this FD leakage be avoided? Thanks in advance, Barry -- Barry Mishler System/Network Manager Japan Engineer District U.S. Army Corps of Engineers ------_=_NextPart_001_01C15DD5.C23E8920 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3Diso-8859-1"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2653.12"> <TITLE>Timeout on dns resolver functions</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2>I'm sure this has been discussed before but I've been = unable to find a proper solution...</FONT> </P> <P><FONT SIZE=3D2>Is there a nice portable way to establish a timeout = on the resolver routines?</FONT> </P> <P><FONT SIZE=3D2>I let trafshow run for several hours when it caused a = flood of 'File Table Full' syslog messages. It turns out that the = trafshow code sets an alarm() before it calls gethostbyaddr and then it = wraps the whole thing inside a setjmp block. When the reverse = lookup takes too long, the gethostbyaddr is terminated ungracefully = leaving a file descriptor open. After a while, this file = descriptor leakage fills up the table.</FONT></P> <P><FONT SIZE=3D2>I've found that trafshow's addrtoname.c was lifted = pretty much straight out of the tcpdump collection. The biggest = difference is that tcpdump waits 20 seconds whereas trafshow defaults = to a 2-second wait in order to keep things moving. So I can only = assume that tcpdump would similarly fill up the FD table if given the = chance.</FONT></P> <P><FONT SIZE=3D2>I don't know if this is relevant, but trafshow never = leaked descriptors until I upgraded from some version of 4.0-STABLE to = 4.1-RELEASE. I confirmed this on two machines. I never got = around to tracking it down until recently. Sorry.</FONT></P> <P><FONT SIZE=3D2>So what's a portable program to do? How can = this FD leakage be avoided?</FONT> </P> <P><FONT SIZE=3D2>Thanks in advance,</FONT> <BR><FONT SIZE=3D2>Barry</FONT> </P> <P><FONT SIZE=3D2>--</FONT> <BR><FONT SIZE=3D2>Barry Mishler</FONT> <BR><FONT SIZE=3D2>System/Network Manager</FONT> <BR><FONT SIZE=3D2>Japan Engineer District</FONT> <BR><FONT SIZE=3D2>U.S. Army Corps of Engineers</FONT> </P> </BODY> </HTML> ------_=_NextPart_001_01C15DD5.C23E8920-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?06F2D681CAF4774DBDD5852190A0CC213EF968>