PING: Unexpected ArithmeticException at sun.jvm.hotspot.utilities.CompactHashTable
Dmitry Samersoff
dmitry.samersoff at oracle.com
Mon Mar 7 11:48:38 UTC 2016
Yuji,
CR number is JDK-8151368
-Dmitry
On 2016-02-22 15:31, KUBOTA Yuji wrote:
> Hi all,
>
> Could you please review this patch?
> I do not have any account at openjdk now, so I need a sponsor.
>
> Thanks,
> Yuji
>
> 2015-12-18 15:27 GMT+09:00 KUBOTA Yuji <kubota.yuji at gmail.com>:
>> Hi all,
>>
>> I caught an unexpected java.lang.ArithmeticException by CLHSDB through
>> jhsdb as below.
>>
>> -----
>> ./jhsdb clhsdb --pid 16809
>> Attaching to process 16809, please wait...
>> hsdb> class java/lang/ArithmeticException
>> java/lang/ArithmeticException @0x0000000100011958
>> hsdb> class java
>> class not found: java
>> hsdb> class java/lang
>> Error: java.lang.ArithmeticException: / by zero
>> -----
>>
>> I think that CLHSDB returns "class not found: java/lang". But
>> ArithmetricException is returned instead.
>> CLHSDB tries to search the given class name from the regular symbol
>> table and the shared symbol table.
>> And called the probe function of the shared symbol table does not
>> support a case of the empty bucket such as below expression
>>
>>> long index = hash % bucketCount();
>>
>> then, throws ArithmetricException.
>>
>> The stack trace of this java.lang.ArithmeticException is here.
>> ------
>> java.lang.ArithmeticException: / by zero
>> at sun.jvm.hotspot.utilities.CompactHashTable.probe(CompactHashTable.java:89)
>> at sun.jvm.hotspot.memory.SymbolTable.probe(SymbolTable.java:97)
>> at sun.jvm.hotspot.memory.SymbolTable.probe(SymbolTable.java:75)
>> at sun.jvm.hotspot.memory.SystemDictionary.find(SystemDictionary.java:149)
>> at sun.jvm.hotspot.utilities.SystemDictionaryHelper.findInstanceKlass(SystemDictionaryHelper.java:107)
>> at jdk.nashorn.internal.scripts.Script$Recompilation$2402$7541A$sa.main$jclass(sa.js:247)
>> at jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:625)
>> at jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:511)
>> at jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:393)
>> at jdk.nashorn.api.scripting.ScriptObjectMirror.callMember(ScriptObjectMirror.java:199)
>> at jdk.nashorn.api.scripting.NashornScriptEngine.invokeImpl(NashornScriptEngine.java:383)
>> at jdk.nashorn.api.scripting.NashornScriptEngine.invokeFunction(NashornScriptEngine.java:190)
>> at sun.jvm.hotspot.utilities.soql.JSJavaScriptEngine.call(JSJavaScriptEngine.java:78)
>> at sun.jvm.hotspot.CommandProcessor$52.doit(CommandProcessor.java:1755)
>> at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1951)
>> at sun.jvm.hotspot.CommandProcessor.executeCommand(CommandProcessor.java:1921)
>> at sun.jvm.hotspot.CommandProcessor.run(CommandProcessor.java:1801)
>> at sun.jvm.hotspot.CLHSDB.run(CLHSDB.java:99)
>> at sun.jvm.hotspot.CLHSDB.main(CLHSDB.java:40)
>> at sun.jvm.hotspot.SALauncher.runCLHSDB(SALauncher.java:134)
>> at sun.jvm.hotspot.SALauncher.main(SALauncher.java:334)
>> ------
>>
>> I have created a patch from jdk9/dev/hotspot (changeset:
>> 9625:de592ea5f7ba) as below, and checked to return "class not found
>> java/lang" correctly. Please review it.
>>
>> diff --git a/agent/src/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java
>> b/agent/src/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java
>> --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java
>> +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/CompactHashTable.java
>> @@ -86,6 +86,10 @@
>> Address baseAddress = baseAddressField.getValue(addr);
>> Address bucket = bucketsField.getValue(addr);
>> Address bucketEnd = bucket;
>> +
>> + if (bucketCount() == 0) {
>> + return null;
>> + }
>> long index = hash % bucketCount();
>> int bucketInfo = (int)bucket.getCIntegerAt(index * uintSize,
>> uintSize, true);
>> int bucketOffset = bucketOffset(bucketInfo);
>>
>>
>> Thanks,
>> Yuji
--
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* I would love to change the world, but they won't give me the sources.
More information about the serviceability-dev
mailing list