From owner-freebsd-java@FreeBSD.ORG Wed Oct 31 20:26:17 2007 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6290416A41A for ; Wed, 31 Oct 2007 20:26:17 +0000 (UTC) (envelope-from freebsd@spatula.net) Received: from turing.morons.org (turing.morons.org [208.96.51.42]) by mx1.freebsd.org (Postfix) with ESMTP id 2F50B13C48D for ; Wed, 31 Oct 2007 20:26:16 +0000 (UTC) (envelope-from freebsd@spatula.net) Received: from turing.morons.org (spatula@localhost [127.0.0.1]) by turing.morons.org (8.14.1/8.14.1) with ESMTP id l9VKPqwF002687 for ; Wed, 31 Oct 2007 13:25:52 -0700 (PDT) (envelope-from freebsd@spatula.net) Received: from localhost (spatula@localhost) by turing.morons.org (8.14.1/8.14.1/Submit) with ESMTP id l9VKPqxR002684 for ; Wed, 31 Oct 2007 13:25:52 -0700 (PDT) (envelope-from freebsd@spatula.net) X-Authentication-Warning: turing.morons.org: spatula owned process doing -bs Date: Wed, 31 Oct 2007 13:25:51 -0700 (PDT) From: Nick Johnson X-X-Sender: spatula@turing To: freebsd-java@freebsd.org In-Reply-To: <20071029163446.L25435@turing> Message-ID: <20071031132106.P1679@turing> References: <20071023195511.GA27666@misty.eyesbeyond.com> <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> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: Simple, reliable test case for name resolution problem X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Oct 2007 20:26:17 -0000 I have verified that this testcase works on a recent 6-STABLE, so it was apparently a libc or kernel bug that was getting tickled around doing a socket operation with a large-numbered file descriptor, which has since been fixed. Nick On Mon, 29 Oct 2007, Nick Johnson 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! > > } > } > > > -- "Courage isn't just a matter of not being frightened, you know. It's being afraid and doing what you have to do anyway." Doctor Who - Planet of the Daleks This message has been brought to you by Nick Johnson 2.3b1 and the number 6. http://healerNick.com/ http://morons.org/ http://spatula.net/