JDK-6999109 : G1: ParallelClassLoading tests fail with java.io.FileNotFoundException (Too many open files)
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs20
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2010-11-10
  • Updated: 2013-09-18
  • Resolved: 2010-12-01
Related Reports
Duplicate :  
Relates :  
The failure:

java.lang.NoClassDefFoundError exception is caught in "Loading Thread #1": custom/A1
java.lang.NoClassDefFoundError: custom/A1
Caused by: java.io.FileNotFoundException: /net/sqenfs-1.sfbay/export1/comp/vm/testbase/sqe/vm/7/build/execution/vm/bin/classes/runtime/ParallelClassLoading/shared/hierarchies/static-load/independent/custom/A1.class (Too many open files) 


I can easy reproduce it with latest jdk7b117 (with both product and fastdebug) and -XX:+UseG1GC.
No errors in case G1 is not used.

Errors seem to occur only on Linux. Test passes when run manually on sparc/solaris.

It looks like the error started to appear from hs20b02/jdk7b115.
At least the above test works fine with hs20b01/jdk7b114. 


Increasing the perm gen size has no effect on failure.

Conjecture: It is possible that the failure is because of slow (or missing)
finalization leaving many open file descriptors. G1's young collections,
the only ones that happen here, do not process reference objects.
Since there is no backpressure from the exploding file descriptor
counts back to the GC to ask it to collect the entire heap and
process reference objects, these file descriptors proliferate until
we run out of them. It is not clear why it was not happening prior to 7b114,
though, so we need to investigate that angle a bit.

EVALUATION This is an instance of the general issue described in RFE 6927479, which I have added to the "See Also" section. The tests should probably be configured to ensure that GC's run frequently enough to cause finalization of otherwise scarce file descriptors. As "server heap-size ergo" becomes more ubiquitous and as platforms come packed with more RAM, these issues are likely to become more common.

EVALUATION The CR to enable ref processing during evac pauses is 6484982.

EVALUATION Test passes if you force full gc's (which lead to finalization) by for example running with a small perm gen which forces periodic full gc's top recycle space in perm (and as a side-effect causes reference processing which leads to finalization). Otherwise, since G1's young collections do not do reference processing, finalizers do not get run promptly and the test fails. I think this can be closed as a duplicate of the G1 reference processing RFE to do reference processing also during young collections of G1.