JDK-8129330 : JDK 9 b64 breaks bzip2 decompression of Commons Compress and Ant
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86_64
  • Submitted: 2015-06-18
  • Updated: 2015-06-22
  • Resolved: 2015-06-22
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b65)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b65, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

but the same behavior has been confirmed for Windows (unknown version) as well

A DESCRIPTION OF THE PROBLEM :
The code inside of Commons Compress runs into random Exceptions after the VM has been warmed up that don't occur with JDK8.  The exceptions indicate internal arrays got corrupted, the "after the VM has been warmed up" point into the direction of the JIT - so maybe I've picked the wrong product category.


ADDITIONAL REGRESSION INFORMATION: 
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b65)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b65, mixed mode)


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile 

import org.apache.commons.compress.utils.IOUtils;
public class Bzip2DecompressorLoop {
     public static void main(String[] args) throws IOException {
         int loops = 0;
         while (true) {
             ByteArrayOutputStream devNull = new ByteArrayOutputStream();
             BZip2CompressorInputStream in = new BZip2CompressorInputStream(new FileInputStream("bla.tar.bz2"));
             IOUtils.copy(in, devNull);
             System.err.println("Finished loop: " + (loops++));
         }
     }
}

against Apache Commons Compress 1.9.  Run it using https://svn.apache.org/repos/asf/commons/proper/compress/trunk/src/test/resources/bla.txt.bz2 as input file.

It's not always the same number but somewhere around "loop 53" I get a
"BZip2 CRC error" when using JDK 9 b64 - this is after decompressing the
same file several times without any problems.  With JDK8 I never get any exception.



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Arbitrary loops of the program above without any exception.
ACTUAL -
An exception.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
No crash at all.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
see above
---------- END SOURCE ----------


Comments
Files attached: ============ Bzip2DecompressorLoop.java commons-compress-1.2.jar bla.txt.bz2 1. Run the attached test case in Linxu (64-bit) and Windows (64-bit). 2. Checked this for JDK 8u45, 8u60 ea b19, 9 ea b63, 9 ea b64, and 9 ea b69. Result: ========= 8u45: OK 8u60 ea b19: OK 9 ea b63: OK 9 ea b64: FAIL 9 ea b69: FAIL 3. Output with 9 ea b64 ==================== Finished loop: 1 Finished loop: 2 Finished loop: 3 ..... ..... ..... Finished loop: 518 Finished loop: 519 Finished loop: 520 Finished loop: 521 Finished loop: 522 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 26 at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.setupBlock(BZip2CompressorInputStream.java:764) at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.init(BZip2CompressorInputStream.java:224) at org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream.<init>(BZip2CompressorInputStream.java:112) at Bzip2DecompressorLoop.main(Bzip2DecompressorLoop.java:11) 4. Conclusion: ============ This issue is reproducible with JDK 9 ea b64 and onwards. For JDK 8u45, 8u60 ea b19, and 9 ea b63 the program continued to run arbitrary loop without any exception.
19-06-2015