JDK-8208462 : SymbolTable::symbols_do using do_scan can deadlock
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2018-07-27
  • Updated: 2020-05-26
  • Resolved: 2020-01-28
Related Reports
Blocks :  
Relates :  
Relates :  
Description
As seen in JDK-8195100 SymbolTable::symbols_do using do_scan can deadlock, so we changed it to try_scan for now, but do we need the lock there at alll?

Since SymbolTable::symbols_do is at a Safepoint, do we really need the "resize lock" there?
Comments
Runtime Triage: This is not on our current list of priorities. We will consider this feature if we receive additional customer requirements.
28-01-2020

The deadlock: thread #3 frame #0: 0x00007fff5376ca16 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x00007fff53935589 libsystem_pthread.dylib`_pthread_cond_wait + 732 frame #2: 0x0000000106782030 libjvm.dylib`os::PlatformEvent::park() + 254 frame #3: 0x0000000106922469 libjvm.dylib`ParkCommon(ParkEvent*, long) + 19 frame #4: 0x0000000106922c94 libjvm.dylib`Monitor::IWait(Thread*, long) + 202 frame #5: 0x0000000106924032 libjvm.dylib`Monitor::wait(bool, long, bool) + 1134 frame #6: 0x000000010692642e libjvm.dylib`VMThread::execute(VM_Operation*) + 932 frame #7: 0x0000000106f9d3ce libjvm.dylib`HeapDumper::dump(char const*) + 466 frame #8: 0x0000000106f9d753 libjvm.dylib`HeapDumper::dump_heap(bool) + 443 frame #9: 0x0000000106bbcd09 libjvm.dylib`report_java_out_of_memory(char const*) + 79 frame #10: 0x00000001067b8480 libjvm.dylib`Metaspace::report_metadata_oome(ClassLoaderData*, unsigned long, MetaspaceObj::Type, Metaspace::MetadataType, Thread*) + 570 frame #11: 0x00000001067b8176 libjvm.dylib`Metaspace::allocate(ClassLoaderData*, unsigned long, MetaspaceObj::Type, Thread*) + 566 frame #12: 0x0000000106db575e libjvm.dylib`ConstantPool::allocate(ClassLoaderData*, int, Thread*) + 72 frame #13: 0x0000000106b6418f libjvm.dylib`ClassFileParser::parse_stream(ClassFileStream const*, Thread*) + 1209 frame #14: 0x0000000106b63ca8 libjvm.dylib`ClassFileParser::ClassFileParser(ClassFileStream*, Symbol*, ClassLoaderData*, Handle, InstanceKlass const*, GrowableArray<Handle>*, ClassFileParser::Publicity, Thread*) + 1338 frame #15: 0x0000000106b8c01c libjvm.dylib`KlassFactory::create_from_stream(ClassFileStream*, Symbol*, ClassLoaderData*, Handle, InstanceKlass const*, GrowableArray<Handle>*, Thread*) + 452 frame #16: 0x0000000106b2a955 libjvm.dylib`SystemDictionary::resolve_from_stream(Symbol*, Handle, Handle, ClassFileStream*, Thread*) + 251 frame #17: 0x0000000106b05aaa libjvm.dylib`jvm_define_class_common(JNIEnv_*, char const*, _jobject*, signed char const*, int, _jobject*, char const*, Thread*) + 724 frame #18: 0x0000000106b05d0f libjvm.dylib`JVM_DefineClassWithSource + 458 frame #19: 0x00000001092035bb libjava.dylib`Java_java_lang_ClassLoader_defineClass1(env=0x00007fad77800b90, cls=<unavailable>, loader=0x00000001053fb7c8, name=<unavailable>, data=<unavailable>, offset=<unavailable>, length=<unavailable>, pd=<unavailable>, source=<unavailable>) at ClassLoader.c:136 [opt] frame #20: 0x000000011a7931c4 thread #9, name = 'Java: VM Thread' frame #0: 0x00007fff5376cd82 libsystem_kernel.dylib`__semwait_signal + 10 frame #1: 0x00007fff536e7724 libsystem_c.dylib`nanosleep + 199 frame #2: 0x00000001067865a6 libjvm.dylib`os::naked_short_sleep(long) + 164 frame #3: 0x0000000106bbbb6c libjvm.dylib`SpinYield::yield_or_sleep() + 62 frame #4: 0x0000000106b3d6d9 libjvm.dylib`ConcurrentHashTable<Symbol*, SymbolTableConfig, (MemoryType)9>::lock_resize_lock(Thread*) + 149 frame #5: 0x0000000106b39b17 libjvm.dylib`void ConcurrentHashTable<Symbol*, SymbolTableConfig, (MemoryType)9>::do_scan<SymbolsDo>(Thread*, SymbolsDo&) + 97 frame #6: 0x0000000106b39aac libjvm.dylib`SymbolTable::symbols_do(SymbolClosure*) + 148 frame #7: 0x0000000106f9cb2f libjvm.dylib`VM_HeapDumper::doit() + 367 frame #8: 0x00000001069a1dc5 libjvm.dylib`VM_Operation::evaluate() + 177 frame #9: 0x0000000106925dd5 libjvm.dylib`VMThread::evaluate_operation(VM_Operation*) + 283 frame #10: 0x0000000106925716 libjvm.dylib`VMThread::loop() + 372 frame #11: 0x000000010692546e libjvm.dylib`VMThread::run() + 206 frame #12: 0x000000010678411d libjvm.dylib`thread_native_entry(Thread*) + 309 frame #13: 0x00007fff53934661 libsystem_pthread.dylib`_pthread_body + 340 frame #14: 0x00007fff5393450d libsystem_pthread.dylib`_pthread_start + 377 frame #15: 0x00007fff53933bf9 libsystem_pthread.dylib`thread_start + 13 thread #16, name = 'Java: Service Thread' frame #0: 0x00007fff5376ca16 libsystem_kernel.dylib`__psynch_cvwait + 10 frame #1: 0x00007fff53935589 libsystem_pthread.dylib`_pthread_cond_wait + 732 frame #2: 0x0000000106782030 libjvm.dylib`os::PlatformEvent::park() + 254 frame #3: 0x0000000106922338 libjvm.dylib`Monitor::ILock(Thread*) + 310 frame #4: 0x00000001069234ed libjvm.dylib`Monitor::lock_without_safepoint_check(Thread*) + 177 frame #5: 0x00000001069c1a73 libjvm.dylib`SafepointSynchronize::block(JavaThread*) + 561 frame #6: 0x0000000106a56623 libjvm.dylib`SafepointMechanism::block_if_requested_local_poll(JavaThread*) + 35 frame #7: 0x0000000106a5659f libjvm.dylib`ThreadStateTransition::transition_and_fence(JavaThread*, JavaThreadState, JavaThreadState) + 191 frame #8: 0x0000000106b3b553 libjvm.dylib`SymbolTable::grow(JavaThread*) + 193 frame #9: 0x0000000106b3bce1 libjvm.dylib`SymbolTable::concurrent_work(JavaThread*) + 149 frame #10: 0x0000000106934588 libjvm.dylib`ServiceThread::service_thread_entry(JavaThread*, Thread*) + 438 frame #11: 0x000000010692b46d libjvm.dylib`JavaThread::thread_main_inner() + 367 frame #12: 0x000000010692afd6 libjvm.dylib`JavaThread::run() + 646 frame #13: 0x000000010678411d libjvm.dylib`thread_native_entry(Thread*) + 309 frame #14: 0x00007fff53934661 libsystem_pthread.dylib`_pthread_body + 340 frame #15: 0x00007fff5393450d libsystem_pthread.dylib`_pthread_start + 377 frame #16: 0x00007fff53933bf9 libsystem_pthread.dylib`thread_start + 13
27-07-2018