From aditya@grot.org  Fri Apr  2 05:52:12 2004
Return-Path: <aditya@grot.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP
	id BAC0E16A4D0; Fri,  2 Apr 2004 05:52:12 -0800 (PST)
Received: from mighty.grot.org (66-117-150-96.web.lmi.net [66.117.150.96])
	by mx1.FreeBSD.org (Postfix) with ESMTP
	id 302BA43D2D; Fri,  2 Apr 2004 05:52:12 -0800 (PST)
	(envelope-from aditya@grot.org)
Received: by mighty.grot.org (Postfix, from userid 515)
	id B48DC5D73; Fri,  2 Apr 2004 13:52:11 +0000 (GMT)
Message-Id: <20040402135211.GF22597@mighty.grot.org>
Date: Fri, 2 Apr 2004 08:52:11 -0500
From: Aditya <aditya@grot.org>
To: FreeBSD-gnats-submit@freebsd.org, Greg Lewis <glewis@freebsd.org>
In-Reply-To: <200404020058.i320w5J6089209@misty.eyesbeyond.com>
Subject: Re: Diablo 1.3.1 JVM runs out of file descriptors at 1021
References: <200404020058.i320w5J6089209@misty.eyesbeyond.com>

>Number:         65074
>Category:       java
>Synopsis:       Re: Diablo 1.3.1 JVM runs out of file descriptors at 1021
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    ceri
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 02 06:00:33 PST 2004
>Closed-Date:    Fri Apr 02 09:39:37 PST 2004
>Last-Modified:  Fri Apr 02 09:39:37 PST 2004
>Originator:     
>Release:        
>Organization:
>Environment:
>Description:
 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 -------------
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: ceri 
State-Changed-When: Fri Apr 2 09:39:02 PST 2004 
State-Changed-Why:  
Misfiled followup to java/65074 [content migrated]. 


Responsible-Changed-From-To: gnats-admin->ceri 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Fri Apr 2 09:39:02 PST 2004 
Responsible-Changed-Why:  
Take from gnats-admin. 

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