RFR JDK-8148624: Test failure of ConstructInflaterOutput.java

Xueming Shen xueming.shen at oracle.com
Sat Feb 13 04:58:37 UTC 2016


Please help review the change for JDK-8148624

Issue: https://bugs.openjdk.java.net/browse/JDK-8148624
Webrev: http://cr.openjdk.java.net/~sherman/8148624/webrev/

The tests are intended to test/verify that the Deflater/Inflater.end() 
method will
not be invoked when they are passed in as the parameter to the 
constructor of
the DefaultInputStream and InflateOutputStream class, when the corresponding
close&/finish() method are invoked.  The stacktrace suggests that the end()
method is not actually being called (failure) by the close/finish(), but 
by the
finalize(). It appears the deflater/inflater is somehow being finalized 
by gc
between A and B showed below

     public static void main(String[] args) throws Throwable {
         try {realMain(args);} catch (Throwable t) {unexpected(t);}
         System.out.println("\nPassed = " + passed + " failed = " + failed);
         if (failed > 0) throw new AssertionError("Some tests failed");}

the problem can be easily reproduced by inserting a System.gc() in between.

The easy fix is just move the inflater/deflater out of realMain() to be 
the static variable
to prevent them from being gc-ed.


More information about the core-libs-dev mailing list