Date: Mon, 29 Oct 2007 18:50:05 -0700 From: Alfred Perlstein <alfred@freebsd.org> To: Nick Johnson <freebsd@spatula.net> Cc: freebsd-java@freebsd.org Subject: Re: Simple, reliable test case for name resolution problem Message-ID: <20071030015005.GM33488@elvis.mu.org> In-Reply-To: <20071029163446.L25435@turing> References: <20071023170536.H25435@turing> <20071024210348.GA34044@misty.eyesbeyond.com> <20071026205754.15950c80@tinca> <20071026121159.A25435@turing> <20071026134734.M25435@turing> <20071026162351.B25435@turing> <20071028130627.A25435@turing> <20071028141053.G25435@turing> <20071029152022.H25435@turing> <20071029163446.L25435@turing>
index | next in thread | previous in thread | raw e-mail
* Nick Johnson <freebsd@spatula.net> [071029 18:31] wrote:
> The problem is in the number of open file descriptors. Once it crosses
> 1024, name resolution breaks. This is showing up in Tomcat 6, because
> Tomcat 6 is leaking descriptors like a sieve.
>
> Here's a simple test case that demonstrates the problem. On my FreeBSD
> 6.2 host it bombs every time. On a Linux host, it throws an IOException
> opening files (too many open files). On a Windows box it completes
> normally.
>
> My uname and java -version, just for completeness:
> FreeBSD turing.morons.org 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Jan 21 16:53:54 PST 2007
> java version "1.5.0_13-p7"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-p7-root_26_oct_2007_14_03)
>
> The same thing happens with the Diablo JDK.
>
> Here's the code. Save it as Test.java; javac Test.java; java Test
>
> import java.net.*;
> import java.util.*;
> import java.io.*;
>
> public class Test {
> public static void main(String[] args) throws Exception {
>
> ArrayList files = new ArrayList(1024);
>
> System.out.println("Opening lots of files");
> for(int i=0; i < 1024; i++) {
> files.add(new FileInputStream("/dev/null"));
> }
>
> System.out.println("Trying to resolve freebsd.org");
> InetAddress.getByName("freebsd.org"); // throws exception!
>
> }
> }
>
Please try attached patch from cvs:
jhb 2007-03-12 19:51:57 UTC
FreeBSD src repository
Modified files: (Branch: RELENG_6)
lib/libc/resolv res_send.c
Log:
MFC: Don't reject file descriptors higher than FD_SETSIZE when using
kevent(2).
Revision Changes Path
1.2.2.5 +5 -7 src/lib/libc/resolv/res_send.c
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071030015005.GM33488>
