From glewis@misty.eyesbeyond.com  Thu Apr  1 16:58:10 2004
Return-Path: <glewis@misty.eyesbeyond.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 99A5316A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  1 Apr 2004 16:58:10 -0800 (PST)
Received: from etrn.xmission.com (etrn.xmission.com [198.60.22.17])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 46A3C43D48
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  1 Apr 2004 16:58:10 -0800 (PST)
	(envelope-from glewis@misty.eyesbeyond.com)
Received: from glewis.dsl.xmission.com ([166.70.56.15] helo=misty.eyesbeyond.com)
	by etrn.xmission.com with esmtp (Exim 4.22)
	id 1B9D0a-0002Oi-RL; Thu, 01 Apr 2004 17:58:08 -0700
Received: from misty.eyesbeyond.com (localhost.eyesbeyond.com [127.0.0.1])
	by misty.eyesbeyond.com (8.12.10/8.12.10) with ESMTP id i320w65G089212;
	Thu, 1 Apr 2004 17:58:06 -0700 (MST)
	(envelope-from glewis@misty.eyesbeyond.com)
Received: (from glewis@localhost)
	by misty.eyesbeyond.com (8.12.10/8.12.10/Submit) id i320w5J6089209;
	Thu, 1 Apr 2004 17:58:05 -0700 (MST)
	(envelope-from glewis)
Message-Id: <200404020058.i320w5J6089209@misty.eyesbeyond.com>
Date: Thu, 1 Apr 2004 17:58:05 -0700 (MST)
From: Greg Lewis <glewis@freebsd.org>
Reply-To: Greg Lewis <glewis@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Aditya <aditya@grot.org>
Subject: Diablo 1.3.1 JVM runs out of file descriptors at 1021
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         65054
>Category:       java
>Synopsis:       Diablo 1.3.1 JVM runs out of file descriptors at 1021
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    glewis
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 01 17:00:37 PST 2004
>Closed-Date:    Thu Aug 18 03:39:32 UTC 2011
>Last-Modified:  Thu Aug 18 03:39:32 UTC 2011
>Originator:     Greg Lewis
>Release:        FreeBSD 4.9-STABLE i386
>Organization:
FreeBSD Project
>Environment:
System: FreeBSD 4.9-STABLE

>Description:
	As posted on freebsd-java:

I'm using the Diablo 1.3.1 JVM package from www.freebsdfoundation.org on a      
4.9-STABLE machine and it unfortunately seems to exhibit the bug described
at:  
                                                                                
  http://developer.java.sun.com/developer/bugParade/bugs/4189011.html           
                                                                                
interestingly enough, the linux 1.3.1_02 JVM under a 4.6-STABLE machine
does    
not exhibit the problem.                                                        
                                                                                
Is there an updated Diablo (diablo-jdk-noplugin-1.3.1.0 Java Development
Kit    
1.3.1 is what I'm running) that has this fixed or is my only recourse,
other    
than compiling from source, to run under linux emulation?                       
                                                                                
On the Diablo JVM machine (test.java is the program suggested in the bug        
report):

nine[ttyp2]:aditya~> /usr/local/diablo-jdk1.3.1/bin/java test 3000 1 1 test     
Starting 1078434190431                                                          
                                                                                
Opened test0000001020.tst Thread: 0                                             
test0000001021.tst (Too many open files) java.io.FileNotFoundException:         
test0000001021.tst (Too many open files)                                        
Aborting 1078434221065                                                          
                                                                                
nine[ttyp2]:aditya~> /usr/local/diablo-jdk1.3.1/bin/java -version               
java version "1.3.1"                                                            
Java(TM) 2 Runtime Environment, Standard Edition (build diablo-1.3.1-0)         
Classic VM (build diablo-1.3.1-0, green threads, nojit)                         
nine[ttyp2]:aditya~> limit                                                      
cputime         unlimited                                                       
filesize        unlimited                                                       
datasize        524288 kbytes                                                   
stacksize       65536 kbytes                                                    
coredumpsize    unlimited                                                       
memoryuse       unlimited                                                       
vmemoryuse      unlimited
descriptors     11095                                                           
memorylocked    unlimited                                                       
maxproc         5547                                                            
sbsize  unlimited                                                               
                                                                                
                                                                                
And the following on a 4.6-STABLE machine running a 1.3.1_02 JVM under
linux    
emulation (linux-jdk-1.3.1.02_1 Sun Java Development Kit 1.3 for Linux):        
                                                                                
two[ttyp2]:aditya~> java test 3000 1 1 test                                     
Starting 1078434145154                                                          
                                                                                
Closing 1078434235337.tst Thread: 0                                             
                                                                                
two[ttyp2]:aditya~> java -version                                               
java version "1.3.1_02"                                                         
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)           
Classic VM (build 1.3.1_02-b02, green threads, nojit)

>How-To-Repeat:

	The test script the original poster used would be useful.

	We should also see if the same problem afflicts the current jdk13 port.

	Same problem may also affect the jdk12 and jdk14 ports (more testing is
	needed).

>Fix:

	None yet known.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-java->glewis 
Responsible-Changed-By: glewis 
Responsible-Changed-When: Thu Apr 1 17:09:18 PST 2004 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65054 

From: Ceri Davies <ceri@FreeBSD.org>
To: FreeBSD Gnats Submit <freebsd-gnats-submit@FreeBSD.org>
Cc:  
Subject: Re: java/65054: Diablo 1.3.1 JVM runs out of file descriptors at 1021
Date: Fri, 2 Apr 2004 18:38:50 +0100

 Adding to audit trail, from misfiled PR java/65074:
 
 Date: Fri, 2 Apr 2004 08:52:11 -0500
 From: Aditya <aditya@grot.org>
 Message-Id: <20040402135211.GF22597@mighty.grot.org>
 References: <200404020058.i320w5J6089209@misty.eyesbeyond.com>
 
  On Thu, Apr 01, 2004 at 05:58:05PM -0700, Greg Lewis wrote:
  > >How-To-Repeat:
  > 
  > 	The test script the original poster used would be useful.
  
  The script is given in the original bug reporte at the included URL and I have
  appended it below for your testing ease:
  
  >   http://developer.java.sun.com/developer/bugParade/bugs/4189011.html           
  
  // -------------------------------- Source Code of test.java -------------
  import java.io.*;
  import java.util.*;
  
  
  
  /**
  Class to test max. number of open files.
  
  Author: Bharat Gogia
  
  E-mail: xxxxx@xxxxx
  
  Dt:23 Feb. 1998
  
  **/
  
  
  
  class test extends Thread
  {
  
     static Vector m_BrnIdxArray = null;
  
  	int startVal;
  	int maxVal;
  	String path;
  	int thID;
  
  
  	static void zleep(long ms)
  		{
  		try
  			{
  			Thread.currentThread().yield();
  			Thread.currentThread().sleep(ms);
  			}
  		catch (InterruptedException ie)
  			{
  			}
  		}
  
  	public test(int stVal, int mxVal, String sPath, int tID)
  		{
  		maxVal = mxVal;
  		startVal = stVal;
  		path = sPath;
  		}
  
  	static public void main(String [] args)
  		{
  		int maxVal = Integer.parseInt(args[0]);
  		int startVal = Integer.parseInt(args[1]);
  		int totThread = Integer.parseInt(args[2]);
  		String path = new String (args[3]);
  
  		for (int i =0; i< totThread ; i++ )
  			{
  			test t1 = new test( (startVal + (i*maxVal)), maxVal,path, i);
  			t1.start();
  			zleep(10);
  			}
  
  		}
  
  	public void run()
  		{
  		byte buf[] = new byte[512];
  		m_BrnIdxArray = new Vector();
    		RandomAccessFile m_brnDatFile = null;
  	 	System.out.println("Starting " + System.currentTimeMillis() +"\r\n" );
  		for (int i=startVal; i < (startVal+maxVal) ; i++ )
  			{
  			String fname ;
  			fname = (path + FormatIntToString(i, "0000000000",'d')+ ".tst");
  		    try
  		      	{
  		      	m_brnDatFile = new RandomAccessFile(fname, "rw");
  			    m_brnDatFile.write(buf);
  				m_BrnIdxArray.addElement(m_brnDatFile);
  				zleep(20);
  		      	}
  		    catch (Exception eio)
  		      	{
  		      	System.out.println("\r\n" + eio.getMessage() + " " +eio);
  	 			System.out.println("Aborting " +System.currentTimeMillis() + "\r\n" );
  				m_brnDatFile  = null;
  				m_BrnIdxArray.removeAllElements();
  				System.exit(0);
  		      	}
  			System.out.print("Opened " + fname + " Thread: " +thID + "\r" );
  			fname = null;
  			}
  	 	System.out.println("Closing " + System.currentTimeMillis() +"\r\n" );
  		}
  
  
      public static String FormatIntToString(int i, String frmt, char type)
        	{
          String target;
          StringBuffer strbuf = new StringBuffer(frmt);
  		 String strInt;
  
  
          try
            	{
             if(type == 'x' || type == 'X')
  				strInt = Integer.toHexString(i);
  			else
  			   	strInt = Integer.toString(i);
  
  			if (strInt.length() > frmt.length())
  			   	{
  			   	strInt = strInt.substring(0, frmt.length());
  				}
  
  	        strbuf.insert( (frmt.length() - strInt.length()), strInt);
  
             strbuf.setLength(frmt.length());
             target =  new String(strbuf);
  
            	}
          catch (StringIndexOutOfBoundsException sie)
              {
  			 System.out.println("Exception in FormatIntToString "+ sie.getMessage());
              target = null;
  	         }
  
        	return(target);
        	}
  }
  
  
  // -------------------------------- End Source Code of test.java -------------
 
Adding to audit trail from misfiled PR pending/67306:

 Date: Fri, 28 May 2004 15:52:51 -0400
 From: Aditya <aditya@grot.org>

 FWIW, this problem seems to be fixed in a natively compiled 1.4.2 under
 -CURRENT, but that of course doesn't help folks running Diablo...
 
 tiny[ttyp0]:aditya~> uname -a
 FreeBSD tiny.grot.org 5.2-CURRENT FreeBSD 5.2-CURRENT #0: Sun Apr 25 08:01:53
 GMT 2004 aditya@tiny.lan.grot.org:/usr/obj/usr/src/sys/TINY i386
 
 tiny[ttyp0]:aditya~> java -version
 java version "1.4.2-p6"
 Java(TM) 2 Runtime Environment, Standard Edition (build
 1.4.2-p6-aditya_25_apr_2004_16_47)
 Java HotSpot(TM) Client VM (build 1.4.2-p6-aditya_25_apr_2004_16_47, mixed mode)
 
 tiny[ttyp0]:aditya~> java -server test 8000 1 1 out/test
 Starting 1085772913271
 
 Opened out/test0000007233.tst Thread: 0
 out/test0000007234.tst (Too many open files) java.io.FileNotFoundException:
 out/test0000007234.tst (Too many open files)
 Aborting 1085773133113
 
 tiny[ttyp0]:aditya~> limit
 cputime         unlimited
 filesize        unlimited
 datasize        524288 kbytes
 stacksize       65536 kbytes
 coredumpsize    unlimited
 memoryuse       unlimited
 vmemoryuse      unlimited
 descriptors     7236
 memorylocked    unlimited
 maxproc         3618
 sbsize  unlimited
State-Changed-From-To: open->closed 
State-Changed-By: glewis 
State-Changed-When: Thu Aug 18 03:39:32 UTC 2011 
State-Changed-Why:  
All the jdk13 ports have been removed. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=65054 
>Unformatted:
