You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Provides the request to write buffer. The buffer in SnappyOutputStream.java is as follows:
private final byte[] buffer;
This buffer is passed between all the methods until it reaches: #20 #21 0x60000000d56701e0:0 in Unsafe_GetInt () at /wsp/jinteg/SVN/jinteg_h7.0.11.rc1b1/hotspot/src/share/vm/prims/unsafe.cpp:396 #22 0x2000000073400d70 in Java native_call_stub frame #23 0x2000000073413b70 in JNI frame: sun.misc.Unsafe::getInt (java.lang.Object, long) ->int #24 0x2000000073405aa0 in interpreted frame: org.iq80.snappy.UnsafeMemory::loadInt (byte[], int) ->int bci: 50 #25 0x2000000073405de0 in interpreted frame: org.iq80.snappy.SnappyInternalUtils::loadInt (byte[], int) ->int bci: 5
Causing the exception (which you have observed). In the Java API code in file jdk/src/share/classes/sun/misc/Unsafe.java (available for your reference through OpenJDK) contains the following comments before method getInt():
// These work on object fields in the Java heap.// They will not work on elements of packed arrays.FetchesavaluefromagivenJavavariable.
Morespecifically, fetchesafieldorarrayelementwithinthegivenobject <code>o</code> atthegivenoffset, or (if <code>o</code> isnull) fromthememoryaddresswhosenumericalvalueisthegivenoffset.
<p>
Theresultsareundefinedunlessoneofthefollowingcasesistrue:
<ul>
<li>Theoffsetwasobtainedfrom {@link #objectFieldOffset} onthe {@linkjava.lang.reflect.Field} ofsomeJavafieldandtheobjectreferredtoby <code>o</code> isofaclasscompatiblewiththatfield's class.
<li>Theoffsetandobjectreference <code>o</code> (eithernullornon-null) werebothobtainedvia {@link #staticFieldOffset}
and {@link #staticFieldBase} (respectively) fromthereflective {@linkField} representationofsomeJavafield.
<li>Theobjectreferredtoby <code>o</code> isanarray, andtheoffsetisanintegeroftheform <code>B+N*S</code>, where <code>N</code> isavalidindexintothearray, and <code>B</code> and <code>S</code> arethevaluesobtainedby {@link #arrayBaseOffset} and {@link
#arrayIndexScale} (respectively) fromthearray's class. The value
referredtoisthe <code>N</code><em>th</em> elementofthearray.
</ul>
<p>
Ifoneoftheabovecasesistrue, thecallreferencesaspecificJavavariable (fieldorarrayelement). However, theresultsareundefinedifthatvariableisnotinfactofthetypereturnedbythismethod.
<p>
'''
ThecodeinsnappycallsgetIntwithanarbitraryoffset, notobtainedbyanyofthemethodsdescribedabove (apparentlytheonlyavailabledocumentationforthis). Thebehaviorforsuchinvocationofsun.misc.Unsafe::getInt() isundefinedregardlessoftheplatformitisinvokedin.
NotealsothatHP-UXItaniumisabig-endianarchitecture. See:
https://github.com/dain/snappy/commit/a7c9c3cdbd6a0d997975ccbde5c946e07c1684e2 Thispatchmaynotyetbeinthesnappy.jarbundledwithJetBrains' CLion, and may work around the issue.
The text was updated successfully, but these errors were encountered:
I believe the first part of the analysis "The code in snappy calls getInt with an arbitrary offset, not obtained by any of the methods described above" is partially incorrect. The following comes from UnsafeMemory:
Thus, the offset is not arbitrary: it is obtained via the arrayBaseOffset. A potential issue is that the index is NOT multiplied by the array scale obtained by arrayIndexScale, likely due to the assumption that a byte array scale is always one (which is the case for every JVM I have seen).
The likely due to the architecture being big-endian. However, I have filed an issue #25 for the byte array index scale issue.
Steps to reproduce:
Snippet from hs_err.log file:
Current thread (01370200): JavaThread "ApplicationImpl pooled thread 3" [_thread_in_vm, id=30, lwp_id=4383651, stack(2d601000,2d641000)]
HP has kindly provided some analysis:
In our internal discussions, we have arrived at the following conclusions (by understanding the code of snappy):
https://github.com/dain/snappy/blob/master/src/main/java/org/iq80/snappy/SnappyOutputStream.java & http://codenav.org/code.html?project=/org/iq80/snappy/snappy/0.1 .
In the call stack that we have seen:
#31 0x2000000073405c00 in interpreted frame: org.iq80.snappy.SnappyOutputStream::flushBuffer () ->void bci: 17
Provides the request to write buffer. The buffer in SnappyOutputStream.java is as follows:
private final byte[] buffer;
This buffer is passed between all the methods until it reaches:
#20
#21 0x60000000d56701e0:0 in Unsafe_GetInt () at /wsp/jinteg/SVN/jinteg_h7.0.11.rc1b1/hotspot/src/share/vm/prims/unsafe.cpp:396
#22 0x2000000073400d70 in Java native_call_stub frame
#23 0x2000000073413b70 in JNI frame: sun.misc.Unsafe::getInt (java.lang.Object, long) ->int
#24 0x2000000073405aa0 in interpreted frame: org.iq80.snappy.UnsafeMemory::loadInt (byte[], int) ->int bci: 50
#25 0x2000000073405de0 in interpreted frame: org.iq80.snappy.SnappyInternalUtils::loadInt (byte[], int) ->int bci: 5
Causing the exception (which you have observed). In the Java API code in file jdk/src/share/classes/sun/misc/Unsafe.java (available for your reference through OpenJDK) contains the following comments before method getInt():
The text was updated successfully, but these errors were encountered: