The -Xcheck:jni option is an option that performs extra checks JNI code. It's frequently given to customers to determine whether they have a bug in their JNI code, which may cause some other problem. Running the jdk tests with this option causes this test failure:
stdout: FATAL ERROR in native method: ReleasePrimitiveArrayCritical: unrecognized elements
The -Xcheck:jni code checks the guard wrapper around the memory return by ReleasePrimitiveArrayCritical, matches that allocated with GetPrimitiveArrayCritical. Since there's no tag in this wrapper it looks like the memory wasn't allocated with GetPrimitiveArrayCritical (?)
Running test 'jtreg:open/test/jdk/java/util/zip/FlaterTest.java'
[2019-10-02 14:39:50,597] Agent[1]: stdout: ReleasePrimitiveArrayCritical: unrecognized elements. array: 0x00002af048982db0 carray: 0x00002af0489c8030
[2019-10-02 14:39:50,597] Agent[1]: stdout: GuardedMemory(0x00002af048982b80) base_addr=0x00002af0489c8010 tag=0x0000000000000000 user_size=1048576 user_data=0x00002af0489c8030
[2019-10-02 14:39:50,597] Agent[1]: stdout: Header guard @0x00002af0489c8010 is OK
[2019-10-02 14:39:50,598] Agent[1]: stdout: Trailer guard @0x00002af048ac8030 is OK
[2019-10-02 14:39:50,598] Agent[1]: stdout: User data appears to be in use
[2019-10-02 14:39:50,598] Agent[1]: stdout: FATAL ERROR in native method: ReleasePrimitiveArrayCritical: unrecognized elements
[2019-10-02 14:39:50,598] Agent[1]: stdout: at java.util.zip.Deflater.deflateBufferBytes(java.base@14-internal/Native Method)
[2019-10-02 14:39:50,598] Agent[1]: stdout: at java.util.zip.Deflater.deflate(java.base@14-internal/Deflater.java:596)
[2019-10-02 14:39:50,598] Agent[1]: stdout: - locked <0x00000000ef497b98> (a java.util.zip.Deflater$DeflaterZStreamRef)
[2019-10-02 14:39:50,598] Agent[1]: stdout: at java.util.zip.Deflater.deflate(java.base@14-internal/Deflater.java:484)
[2019-10-02 14:39:50,598] Agent[1]: stdout: at FlaterTest.getDeflatedLength(FlaterTest.java:73)
[2019-10-02 14:39:50,598] Agent[1]: stdout: at FlaterTest.go(FlaterTest.java:101)
To reproduce run:
make test TEST=java/util/zip/FlaterTest.java JTREG="VM_OPTIONS=-Xcheck:jni"