|
Quick Lists
|
|
Bug ID:
|
4779905
|
|
Votes
|
35
|
|
Synopsis
|
REGRESSION: If there are too many open files 1.4.1 deletes files
|
|
Category
|
java:classes_io
|
|
Reported Against
|
1.4
, 1.4.1
|
|
Release Fixed
|
1.4.2
|
|
State
|
10-Fix Delivered,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
4784291
|
|
Submit Date
|
15-NOV-2002
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
If there are too many open files an attempt to open one more
file causes that file to be deleted by the VM.
REGRESSION. Last worked in version 1.4
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached demo. It first creates 4500 files and then
attempts to open all 4500 files.
On 1.4.1 this will cause files to be deleted, on 1.4.0 it
works ok.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The demo output with 1.4.1_01:
creating files...
#files=4500
opening all files...
#exceptions=2464
#files=2036
which means the VM has deleted 2464 files!!
if the demo is run under 1.4.0 the output is:
creating files...
#files=4500
opening all files...
#exceptions=2464
#files=4500
this is the way is should be.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.io.*;
import java.util.*;
public class Demo
{
File workDir = new File("demo").getAbsoluteFile();
boolean DEBUG = false;
LinkedList openFiles = new LinkedList();
LinkedList allFiles = new LinkedList();
int numExceptions = 0;
Demo()
{
if(workDir.exists()) {
System.out.println("removing \""+workDir+"\"...");
del(workDir);
}
System.out.println("creating files...");
createFiles(workDir);
stats();
System.out.println("opening all files...");
openAllFiles(workDir);
System.out.println("#exceptions="+numExceptions);
stats();
}
void openAllFiles(File dir)
{
Iterator iter = allFiles.iterator();
while (iter.hasNext()) {
try {
openFiles.add(new RandomAccessFile((File)iter.next(), "rw"));
} catch (Exception ex) {
if(DEBUG) System.out.println(openFiles.size() +"; "+ ex.toString());
numExceptions++;
}
}
}
void createFiles(File dir)
{
if(!workDir.exists()) workDir.mkdir();
for(int k = 0; k < 4500; k++) {
try {
File f = new File(workDir, Integer.toString(k)+".tmp");
allFiles.add(f);
RandomAccessFile raf = new RandomAccessFile(f, "rw");
raf.write(0);
raf.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
void stats()
{
if(!workDir.exists()) System.out.println("dir does not exist");
else System.out.println("#files="+workDir.listFiles().length);
}
void del(File file)
{
if(file.isDirectory()) {
File[] f = file.listFiles();
for (int t = 0; t < f.length; t++) del(f[t]);
}
file.delete();
}
public static void main(String[] a)
{
new Demo();
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.0_02
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 167122)
======================================================================
|
|
Work Around
|
N/A
|
|
Evaluation
|
Probably related to a workaround for opening hidden files introduced in Hopper. Still investigating.
xxxxx@xxxxx 2002-11-15
I believe this problem was resolved by the move to the CreateFile API, since the workaround involving hidden files is no longer in place. The VM currently crashes if it runs out of file descriptors so it is hard to verify this is the case.
xxxxx@xxxxx 2002-11-19
|
|
Comments
|
Submitted On 12-AUG-2003
luthian1
Any chance of a fix for this? It's quite a major bug - we've
had classes deleted by the VM because of this
Submitted On 12-AUG-2003
luthian1
This appears to be fixed in 1.4.2. Is there a reason it
isn't marked as fixed? (Or maybe it working is a coincidence
and it's a regression of the regression?)
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |