-
Bug
-
Resolution: Fixed
-
P4
-
8, 9, 10, 11, 12, 13, 14, 15
-
b13
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8333428 | 11.0.25 | Martin Doerr | P4 | Resolved | Fixed | b01 |
The SkipBytes() subtest in DeflateIn_InflateOut.java executes several steps and for each step it deflates an array of 1024*1024 bytes. In every step, before deflation is performed, the array is refilled with random bytes. However, only after the first step, the size of the generated, deflated stream is checked and recorded. The following subtests all assume that deflating the array filled with the same number but different random bytes will produce a deflated stream of the same size.
This assumption is wrong. Depending on the exact contents of the source array, the size of the generated, deflated result might slightly differ. For some reason, the deflated result produced by the default zlib implementation seems to always have the same size, but other zlib implementations sometimes produce differently sized, deflated results.
The problem can easily be reproduced by placing a version of Cloudflare's zlib clone (https://github.com/cloudflare/zlib) on the LD_LIBRARY_PATH (for jdk versions configured with "--with-zlib=system", which is the default since jdk11):
$ LD_LIBRARY_PATH=/ziptests/build/zlib-cloudflare ./images/jdk/bin/java -cp JTwork_cf/classes/java/util/zip/DeflateIn_InflateOut.d DeflateIn_InflateOut
java.lang.Exception: Stack trace
at java.base/java.lang.Thread.dumpStack(Thread.java:1379)
at DeflateIn_InflateOut.fail(DeflateIn_InflateOut.java:235)
at DeflateIn_InflateOut.check(DeflateIn_InflateOut.java:238)
at DeflateIn_InflateOut.SkipBytes(DeflateIn_InflateOut.java:204)
at DeflateIn_InflateOut.realMain(DeflateIn_InflateOut.java:229)
at DeflateIn_InflateOut.main(DeflateIn_InflateOut.java:243)
Passed = 16 failed = 1
Exception in thread "main" java.lang.AssertionError: Some tests failed
at DeflateIn_InflateOut.main(DeflateIn_InflateOut.java:245)
The fix is trivial. It is unnecessary to refill the source array with random bytes before each subtest. Filling the array one time at test startup time should be sufficient.
This assumption is wrong. Depending on the exact contents of the source array, the size of the generated, deflated result might slightly differ. For some reason, the deflated result produced by the default zlib implementation seems to always have the same size, but other zlib implementations sometimes produce differently sized, deflated results.
The problem can easily be reproduced by placing a version of Cloudflare's zlib clone (https://github.com/cloudflare/zlib) on the LD_LIBRARY_PATH (for jdk versions configured with "--with-zlib=system", which is the default since jdk11):
$ LD_LIBRARY_PATH=/ziptests/build/zlib-cloudflare ./images/jdk/bin/java -cp JTwork_cf/classes/java/util/zip/DeflateIn_InflateOut.d DeflateIn_InflateOut
java.lang.Exception: Stack trace
at java.base/java.lang.Thread.dumpStack(Thread.java:1379)
at DeflateIn_InflateOut.fail(DeflateIn_InflateOut.java:235)
at DeflateIn_InflateOut.check(DeflateIn_InflateOut.java:238)
at DeflateIn_InflateOut.SkipBytes(DeflateIn_InflateOut.java:204)
at DeflateIn_InflateOut.realMain(DeflateIn_InflateOut.java:229)
at DeflateIn_InflateOut.main(DeflateIn_InflateOut.java:243)
Passed = 16 failed = 1
Exception in thread "main" java.lang.AssertionError: Some tests failed
at DeflateIn_InflateOut.main(DeflateIn_InflateOut.java:245)
The fix is trivial. It is unnecessary to refill the source array with random bytes before each subtest. Filling the array one time at test startup time should be sufficient.
- backported by
-
JDK-8333428 DeflateIn_InflateOut.java test incorrectly assumes size of compressed file
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/69f4ac1e
-
Review(master) openjdk/jdk11u-dev/2719