Bug 65054

Summary: Diablo 1.3.1 JVM runs out of file descriptors at 1021
Product: Base System Reporter: Greg Lewis <glewis>
Component: javaAssignee: Greg Lewis <glewis>
Status: Closed FIXED    
Severity: Affects Only Me CC: aditya
Priority: Normal    
Version: 4.9-STABLE   
Hardware: Any   
OS: Any   

Description Greg Lewis freebsd_committer freebsd_triage 2004-04-02 02:00:37 UTC
	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)

Fix: 

None yet known.
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).
Comment 1 Greg Lewis freebsd_committer freebsd_triage 2004-04-02 02:09:18 UTC
Responsible Changed
From-To: freebsd-java->glewis

Over to maintainer.
Comment 2 Ceri Davies freebsd_committer freebsd_triage 2004-04-02 18:38:50 UTC
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 -------------
Comment 3 Greg Lewis freebsd_committer freebsd_triage 2011-08-18 04:39:32 UTC
State Changed
From-To: open->closed

All the jdk13 ports have been removed.