Forcing initialization of string concat INDY expressions
David Holmes
david.holmes at oracle.com
Wed Mar 1 06:36:37 UTC 2017
The INDY-fication of string concatenation has triggered a problem where
a JVM TI agent's monitor-wait/ed callback hits an error path that uses
string concat which triggers a mass of indy related initialization,
which in turn hits monitor use in
MethodType$ConcurrentWeakInternSet.get, which causes the VM monitor
subsystem to be re-entered (and it is not reentrant!) so we crash. (log
extract below - the amount of code to process this is truly scary!)
I'm trying to workaround the problem by forcing some earlier string
concat in the thread in which the callback will execute. From what I can
see the test already does:
log(Thread.currentThread() + "some text");
but the error code is doing:
log("Agent '" + agentName + "' finished execution (finishedSuccessfully:
" + finishedSuccessfully + ")");
where finishedSuccessfully is a boolean, and so we have a different form
of makeConcatWithConstants call site.
I assume I can cover the exact case above by replicating it? But can I
generalize it to cover arbitrary string concat expressions that might
arise on other error paths?
And yes I realize this error code could hit monitor use in numerous
other places, but so far this is the only case that we have seen
trigger. (Though I can't reproduce it - even if I force the error path
to be taken.)
Thanks,
David
-----
V [jvm.dll+0x3ba688] report_vm_error+0x48;;
?report_vm_error@@YAXPBDH00ZZ+0x48
V [jvm.dll+0x7608f0] ObjectMonitor::enter+0x170;;
?enter at ObjectMonitor@@QAEXPAVThread@@@Z+0x170
V [jvm.dll+0x862035] ObjectSynchronizer::slow_enter+0x1d5;;
?slow_enter at ObjectSynchronizer@@SAXVHandle@@PAVBasicLock@@PAVThread@@@Z+0x1d5
V [jvm.dll+0x85fe8f] ObjectSynchronizer::fast_enter+0xff;;
?fast_enter at ObjectSynchronizer@@SAXVHandle@@PAVBasicLock@@_NPAVThread@@@Z+0xff
V [jvm.dll+0x2b5412] Runtime1::monitorenter+0x1e2;;
?monitorenter at Runtime1@@CAXPAVJavaThread@@PAVoopDesc@@PAVBasicObjectLock@@@Z+0x1e2
v ~RuntimeStub::monitorenter_nofpu Runtime1 stub
J 192 c1
java.lang.invoke.MethodType$ConcurrentWeakInternSet.get(Ljava/lang/Object;)Ljava/lang/Object;
java.base at 9-internal (54 bytes) @ 0x0242d7da [0x0242d4c0+0x0000031a]
J 190 c1
java.lang.invoke.MethodType.makeImpl(Ljava/lang/Class;[Ljava/lang/Class;Z)Ljava/lang/invoke/MethodType;
java.base at 9-internal (66 bytes) @ 0x0242ca20 [0x0242c9a0+0x00000080]
J 255 c1
java.lang.invoke.MemberName.getMethodOrFieldType()Ljava/lang/invoke/MethodType;
java.base at 9-internal (72 bytes) @ 0x02445238 [0x02444f20+0x00000318]
J 239 c1
java.lang.invoke.InvokerBytecodeGenerator.isStaticallyInvocable(Ljava/lang/invoke/MemberName;)Z
java.base at 9-internal (169 bytes) @ 0x0243dc28 [0x0243d820+0x00000408]
j java.lang.invoke.InvokerBytecodeGenerator.addMethod()V+648
java.base at 9-internal
j
java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCodeBytes()[B+6
java.base at 9-internal
j
java.lang.invoke.InvokerBytecodeGenerator.generateCustomizedCode(Ljava/lang/invoke/LambdaForm;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/MemberName;+25
java.base at 9-internal
j java.lang.invoke.LambdaForm.compileToBytecode()V+69 java.base at 9-internal
j java.lang.invoke.LambdaForm.prepare()V+21 java.base at 9-internal
j
java.lang.invoke.MethodHandle.<init>(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;)V+33
java.base at 9-internal
j
java.lang.invoke.BoundMethodHandle.<init>(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;)V+3
java.base at 9-internal
j
java.lang.invoke.BoundMethodHandle$Species_L9.<init>(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V+3
java.base at 9-internal
j
java.lang.invoke.BoundMethodHandle$Species_L9.copyWith(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/LambdaForm;)Ljava/lang/invoke/BoundMethodHandle;+42
java.base at 9-internal
j
java.lang.invoke.MethodHandles.dropArguments0(Ljava/lang/invoke/MethodHandle;ILjava/util/List;)Ljava/lang/invoke/MethodHandle;+105
java.base at 9-internal
j
java.lang.invoke.MethodHandles.dropArguments(Ljava/lang/invoke/MethodHandle;I[Ljava/lang/Class;)Ljava/lang/invoke/MethodHandle;+6
java.base at 9-internal
j
java.lang.invoke.StringConcatFactory$MethodHandleInlineCopyStrategy.generate(Ljava/lang/invoke/MethodType;Ljava/lang/invoke/StringConcatFactory$Recipe;)Ljava/lang/invoke/MethodHandle;+479
java.base at 9-internal
j
java.lang.invoke.StringConcatFactory.generate(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/StringConcatFactory$Recipe;)Ljava/lang/invoke/MethodHandle;+101
java.base at 9-internal
j
java.lang.invoke.StringConcatFactory.doStringConcat(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;ZLjava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;+507
java.base at 9-internal
j
java.lang.invoke.StringConcatFactory.makeConcatWithConstants(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite;+71
java.base at 9-internal
j
java.lang.invoke.DirectMethodHandle$Holder.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+18
java.base at 9-internal
j
java.lang.invoke.LambdaForm$BMH.reinvoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+48
java.base at 9-internal
j
java.lang.invoke.Invokers$Holder.invoke_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+26
java.base at 9-internal
j
java.lang.invoke.CallSite.makeSite(Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/invoke/CallSite;+134
java.base at 9-internal
j
java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(Ljava/lang/Class;Ljava/lang/invoke/MethodHandle;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/invoke/MemberName;+6
java.base at 9-internal
j
java.lang.invoke.MethodHandleNatives.linkCallSite(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/invoke/MemberName;+45
java.base at 9-internal
v ~StubRoutines::call_stub
V [jvm.dll+0x526f80] JavaCalls::call_helper+0x390;;
?call_helper at JavaCalls@@CAXPAVJavaValue@@ABVmethodHandle@@PAVJavaCallArguments@@PAVThread@@@Z+0x390
V [jvm.dll+0x7777c5] os::os_exception_wrapper+0xb5;;
?os_exception_wrapper at os@@SAXP6AXPAVJavaValue@@ABVmethodHandle@@PAVJavaCallArguments@@PAVThread@@@Z0123 at Z+0xb5
V [jvm.dll+0x526bdb] JavaCalls::call+0x5b;;
?call at JavaCalls@@SAXPAVJavaValue@@ABVmethodHandle@@PAVJavaCallArguments@@PAVThread@@@Z+0x5b
V [jvm.dll+0x527349] JavaCalls::call_static+0xc9;;
?call_static at JavaCalls@@SAXPAVJavaValue@@VKlassHandle@@PAVSymbol@@2PAVJavaCallArguments@@PAVThread@@@Z+0xc9
V [jvm.dll+0x864617]
SystemDictionary::find_dynamic_call_site_invoker+0x687;;
?find_dynamic_call_site_invoker at SystemDictionary@@SA?AVmethodHandle@@VKlassHandle@@VHandle@@PAVSymbol@@2PAV4 at 3PAVThread@@@Z+0x687
V [jvm.dll+0x65eb84] LinkResolver::resolve_dynamic_call+0x44;;
?resolve_dynamic_call at LinkResolver@@SAXAAVCallInfo@@VHandle@@PAVSymbol@@2VKlassHandle@@PAVThread@@@Z+0x44
V [jvm.dll+0x66014e] LinkResolver::resolve_invokedynamic+0x35e;;
?resolve_invokedynamic at LinkResolver@@CAXAAVCallInfo@@ABVconstantPoolHandle@@HPAVThread@@@Z+0x35e
V [jvm.dll+0x65fd7e] LinkResolver::resolve_invoke+0x8e;;
?resolve_invoke at LinkResolver@@SAXAAVCallInfo@@VHandle@@ABVconstantPoolHandle@@HW4Code at Bytecodes@@PAVThread@@@Z+0x8e
V [jvm.dll+0x51eb0b] InterpreterRuntime::resolve_invokedynamic+0x7b;;
?resolve_invokedynamic at InterpreterRuntime@@CAXPAVJavaThread@@@Z+0x7b
V [jvm.dll+0x51dee4] InterpreterRuntime::resolve_from_cache+0xd4;;
?resolve_from_cache at InterpreterRuntime@@SAXPAVJavaThread@@W4Code at Bytecodes@@@Z+0xd4
j
nsk.share.aod.TargetApplicationWaitingAgents.agentFinished(Ljava/lang/String;Z)V+131
v ~StubRoutines::call_stub
V [jvm.dll+0x526f80] JavaCalls::call_helper+0x390;;
?call_helper at JavaCalls@@CAXPAVJavaValue@@ABVmethodHandle@@PAVJavaCallArguments@@PAVThread@@@Z+0x390
V [jvm.dll+0x7777c5] os::os_exception_wrapper+0xb5;;
?os_exception_wrapper at os@@SAXP6AXPAVJavaValue@@ABVmethodHandle@@PAVJavaCallArguments@@PAVThread@@@Z0123 at Z+0xb5
V [jvm.dll+0x526bdb] JavaCalls::call+0x5b;;
?call at JavaCalls@@SAXPAVJavaValue@@ABVmethodHandle@@PAVJavaCallArguments@@PAVThread@@@Z+0x5b
V [jvm.dll+0x597f9a] jni_invoke_static+0x1ba;;
?jni_invoke_static@@YAXPAUJNIEnv_@@PAVJavaValue@@PAV_jobject@@W4JNICallType@@PAU_jmethodID@@PAVJNI_ArgumentPusher@@PAVThread@@@Z+0x1ba
V [jvm.dll+0x57f125] jni_CallStaticVoidMethod+0x1f5;;
_jni_CallStaticVoidMethod+0x1f5
C [attach037Agent00.dll+0x1167]
V [jvm.dll+0x7621cd] ObjectMonitor::wait+0x3bd;;
?wait at ObjectMonitor@@QAEX_J_NPAVThread@@@Z+0x3bd
More information about the core-libs-dev
mailing list