Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native-image] Thread.getAllStackTraces() fails with an error #2101

Closed
tiainen opened this issue Jan 27, 2020 · 14 comments
Closed

[native-image] Thread.getAllStackTraces() fails with an error #2101

tiainen opened this issue Jan 27, 2020 · 14 comments

Comments

@tiainen
Copy link

tiainen commented Jan 27, 2020

Calling Thread.getAllStackTraces() while more than one thread is running, fails with the following error:

Fatal error: Should not reach here: Not okay to block.

JavaFrameAnchor dump:

  No anchors

TopFrame info:

  TotalFrameSize in CodeInfoTable 32

VMThreads info:

  VMThread 000001bfac3bb140  STATUS_IN_SAFEPOINT  java.lang.Thread@0x1bfacb022e0
  VMThread 000001bfac3b7d80  STATUS_IN_JAVA (safepoints disabled)  java.lang.Thread@0x1bfac934190

VM Thread State for current thread 000001bfac3b7d80:

  0 (8 bytes): com.oracle.svm.jni.JNIThreadLocalEnvironment.jniFunctions = (bytes)
    000001bfac3b7d80: 000001bfac89cfc8

  8 (32 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.regularTLAB = (bytes)
    000001bfac3b7d88: 000001bfacb00000 000001bfacc00000
    000001bfac3b7d98: 000001bfacb02e30 0000000000000000


  40 (8 bytes): com.oracle.svm.core.heap.NoAllocationVerifier.openVerifiers = (Object) null
  48 (8 bytes): com.oracle.svm.core.jdk.IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) null
  56 (8 bytes): com.oracle.svm.core.snippets.SnippetRuntime.currentException = (Object) null
  64 (8 bytes): com.oracle.svm.core.thread.JavaThreads.currentThread = (Object) java.lang.Thread  000001bfac934190
  72 (8 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.activeTimer = (Object) null
  80 (8 bytes): com.oracle.svm.jni.JNIObjectHandles.handles = (Object) com.oracle.svm.core.handles.ThreadLocalHandles  000001bfacb01428
  88 (8 bytes): com.oracle.svm.jni.JNIThreadLocalPendingException.pendingException = (Object) null
  96 (8 bytes): com.oracle.svm.jni.JNIThreadLocalPinnedObjects.pinnedObjectsListHead = (Object) null
  104 (8 bytes): com.oracle.svm.jni.JNIThreadOwnedMonitors.ownedMonitors = (Object) null
  112 (8 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.freeList = (Word) 0  0000000000000000
  120 (8 bytes): com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.stackBoundaryTL = (Word) 1  0000000000000001
  128 (8 bytes): com.oracle.svm.core.stack.JavaFrameAnchors.lastAnchor = (Word) 0  0000000000000000
  136 (8 bytes): com.oracle.svm.core.thread.VMThreads.IsolateTL = (Word) 1922742878208  000001bfac680000
  144 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadHandleTL = (Word) 164  00000000000000a4
  152 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadIdTL = (Word) 7308  0000000000001c8c
  160 (8 bytes): com.oracle.svm.core.thread.VMThreads.nextTL = (Word) 0  0000000000000000
  168 (4 bytes): com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.yellowZoneStateTL = (int) -16843010  fefefefe
  172 (4 bytes): com.oracle.svm.core.snippets.ImplicitExceptions.implicitExceptionsAreFatal = (int) 0  00000000
  176 (4 bytes): com.oracle.svm.core.thread.Safepoint.safepointRequested = (int) 2147473412  7fffd804
  180 (4 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.currentPauseDepth = (int) 1  00000001
  184 (4 bytes): com.oracle.svm.core.thread.VMThreads$StatusSupport.safepointsDisabledTL = (int) 1  00000001
  188 (4 bytes): com.oracle.svm.core.thread.VMThreads$StatusSupport.statusTL = (int) 1  00000001

VMOperation dump:

  VMOperation in progress: getAllStackTraces
    causesSafepoint: true
    queuingThread: 000001bfac3b7d80
    executingThread: 000001bfac3b7d80

Dump Counters:


Raw Stacktrace:

  000000bc7a2ff6d0: 000001bfac8d1500 000001bfac7ea518
  000000bc7a2ff6e0: 000001bfac680000 00007ff669b6d6fc
  000000bc7a2ff6f0: 000001bfac8d150a 00007ff669b693c9
  000000bc7a2ff700: 0000000000000001 00007ff669b4149b
  000000bc7a2ff710: 000001bfac7744e8 000001bfac7e6578
  000000bc7a2ff720: 00000002002b3bb8 00007ff669b12c58
  000000bc7a2ff730: 000001bfac885680 000001bfac680018
  000000bc7a2ff740: 000001bfac7e8e70 00007ff669b4abbf
  000000bc7a2ff750: 0000000000002df5 0000000000000001
  000000bc7a2ff760: 00000098ac3b8608 0000000000015729
  000000bc7a2ff770: 00000001acb02d40 000001bfac7e8e70
  000000bc7a2ff780: 0000000000015700 0000000000015729
  000000bc7a2ff790: 000001bfac92c860 00007ff669b5fe6b
  000000bc7a2ff7a0: 0000000000482d40 000001bfacb02d40
  000000bc7a2ff7b0: 000001bfacb02560 00007ff669cff66a
  000000bc7a2ff7c0: 000000bc7a2ff818 00007ff669b60865
  000000bc7a2ff7d0: 000001bfacb02e10 00007ff669b475d5
  000000bc7a2ff7e0: 000001bfac9f9d50 000001bfacb02e10
  000000bc7a2ff7f0: 000001bfacb02560 00007ff669c13a37
  000000bc7a2ff800: 00007ff669b5fcb0 000001bfacb026d8
  000000bc7a2ff810: 000001bfacb022e0 000000a8ac934398
  000000bc7a2ff820: 00000000000000a8 00007ff669bf5819
  000000bc7a2ff830: 0000000300000000 0000000000000050
  000000bc7a2ff840: 000000087a5ff5d0 00007ff669cdf106
  000000bc7a2ff850: 000001bfac3b0000 000001bfacb022e0
  000000bc7a2ff860: 000001bfacb02560 00007ff669cdf78b
  000000bc7a2ff870: 0000000000000028 00007ff669b62a60
  000000bc7a2ff880: 000001bfacb02dc0 000001bfacb022e0
  000000bc7a2ff890: 000001bfacb024d8 00007ff669b633f6
  000000bc7a2ff8a0: 00006433b373d787 0000000000000002
  000000bc7a2ff8b0: 000001bfacb022e0 000001bfacb024d8
  000000bc7a2ff8c0: 000001bfac3bb140 00007ff669b61430
  000000bc7a2ff8d0: 000001bfac3b7d80 000001bfac3c3418
  000000bc7a2ff8e0: 00007ff669b6e800 00007ff669b64fd4
  000000bc7a2ff8f0: 000001bfac8d1000 00007ffdea8a234f
  000000bc7a2ff900: 000001bfacb02520 00007ff669b65618
  000000bc7a2ff910: 00007ff669b266b0 000001bfacb02520
  000000bc7a2ff920: 000001bfacb02520 00007ff669b67fb4
  000000bc7a2ff930: 0000000000000000 000001bfac680000
  000000bc7a2ff940: 000001bfac7e7668 000001bfac680000
  000000bc7a2ff950: 00000000002207f0 000001bfacb02520
  000000bc7a2ff960: 0000000000000000 0000000000000000
  000000bc7a2ff970: 0000000000000000 00007ff669b684ca
  000000bc7a2ff980: 000001bfac3b7d80 00007ff669b669b6
  000000bc7a2ff990: 000001bfaca01828 000001bfaca01828
  000000bc7a2ff9a0: 000001bfacb02520 000001bfaca017d8
  000000bc7a2ff9b0: 000001bfac886778 00007ff669b68c1b
  000000bc7a2ff9c0: 00000000002207f0 000001bfacb02520
  000000bc7a2ff9d0: 000001bfac7e9fd0 000001bfac7e9fd0
  000000bc7a2ff9e0: 000001bfaca017d8 000001bfac8d1070
  000000bc7a2ff9f0: 000001bfaca01828 000001bfac886778
  000000bc7a2ffa00: 0000000100000001 00007ff669b68a24
  000000bc7a2ffa10: 00007ff669b6e897 00007ff669b4149b
  000000bc7a2ffa20: 000001bfac886778 000001bfacb02520
  000000bc7a2ffa30: 0000000000000000 00007ff669b692a1
  000000bc7a2ffa40: 000001bfacb022e0 00007ff669d2e767
  000000bc7a2ffa50: 00000000000000c8 000001bfac680018
  000000bc7a2ffa60: 000001bfacb02520 000001bfac7e7668
  000000bc7a2ffa70: 0000000000000000 00007ff669b65400
  000000bc7a2ffa80: 00007ff669b6e800 000001bfacb024c0
  000000bc7a2ffa90: 000001bfac7e9fd0 00007ff669b6297c
  000000bc7a2ffaa0: 00007ff669e17138 00007ff669e1713e
  000000bc7a2ffab0: 000001bfacb024d8 00007ff669b11569
  000000bc7a2ffac0: 000001bfac7e6418 00007ff669c1503b

Stacktrace Stage0:

  RSP 000000bc7a2ff6d0 RIP 00007ff669b6d776 FrameSize 32
  RSP 000000bc7a2ff6f0 RIP 00007ff669b6d6fc FrameSize 16
  RSP 000000bc7a2ff700 RIP 00007ff669b693c9 FrameSize 48
  RSP 000000bc7a2ff730 RIP 00007ff669b12c58 FrameSize 32
  RSP 000000bc7a2ff750 RIP 00007ff669b4abbf FrameSize 112
  RSP 000000bc7a2ff7c0 RIP 00007ff669cff66a FrameSize 32
  RSP 000000bc7a2ff7e0 RIP 00007ff669b475d5 FrameSize 32
  RSP 000000bc7a2ff800 RIP 00007ff669c13a37 FrameSize 48
  RSP 000000bc7a2ff830 RIP 00007ff669bf5819 FrameSize 32
  RSP 000000bc7a2ff850 RIP 00007ff669cdf106 FrameSize 32
  RSP 000000bc7a2ff870 RIP 00007ff669cdf78b FrameSize 48
  RSP 000000bc7a2ff8a0 RIP 00007ff669b633f6 FrameSize 48
  RSP 000000bc7a2ff8d0 RIP 00007ff669b61430 FrameSize 32
  RSP 000000bc7a2ff8f0 RIP 00007ff669b64fd4 FrameSize 32
  RSP 000000bc7a2ff910 RIP 00007ff669b65618 FrameSize 32
  RSP 000000bc7a2ff930 RIP 00007ff669b67fb4 FrameSize 80
  RSP 000000bc7a2ff980 RIP 00007ff669b684ca FrameSize 64
  RSP 000000bc7a2ff9c0 RIP 00007ff669b68c1b FrameSize 80
  RSP 000000bc7a2ffa10 RIP 00007ff669b68a24 FrameSize 48
  RSP 000000bc7a2ffa40 RIP 00007ff669b692a1 FrameSize 64
  RSP 000000bc7a2ffa80 RIP 00007ff669b65400 FrameSize 32
  RSP 000000bc7a2ffaa0 RIP 00007ff669b6297c FrameSize 32
  RSP 000000bc7a2ffac0 RIP 00007ff669b11569 FrameSize 48
  RSP 000000bc7a2ffaf0 RIP 00007ff669b1131b FrameSize 48
  RSP 000000bc7a2ffb20 RIP 00007ff669b2639d FrameSize 1

Stacktrace Stage1:

  RSP 000000bc7a2ff6d0 RIP 00007ff669b6d776  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff6f0 RIP 00007ff669b6d6fc  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff700 RIP 00007ff669b693c9  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff730 RIP 00007ff669b12c58  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff750 RIP 00007ff669b4abbf  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff7c0 RIP 00007ff669cff66a  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff7e0 RIP 00007ff669b475d5  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff800 RIP 00007ff669c13a37  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff830 RIP 00007ff669bf5819  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff850 RIP 00007ff669cdf106  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff870 RIP 00007ff669cdf78b  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff8a0 RIP 00007ff669b633f6  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff8d0 RIP 00007ff669b61430  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff8f0 RIP 00007ff669b64fd4  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff910 RIP 00007ff669b65618  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff930 RIP 00007ff669b67fb4  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff980 RIP 00007ff669b684ca  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ff9c0 RIP 00007ff669b68c1b  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffa10 RIP 00007ff669b68a24  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffa40 RIP 00007ff669b692a1  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffa80 RIP 00007ff669b65400  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffaa0 RIP 00007ff669b6297c  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffac0 RIP 00007ff669b11569  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffaf0 RIP 00007ff669b1131b  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code
  RSP 000000bc7a2ffb20 RIP 00007ff669b2639d  com.oracle.svm.core.code.CodeInfo@0x1bfac92c860 name = image code

Full Stacktrace:

  RSP 000000bc7a2ff6d0 RIP 00007ff669b6d776  [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shutdown(VMErrorSubstitutions.java:111)
  RSP 000000bc7a2ff6d0 RIP 00007ff669b6d776  [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:74)
  RSP 000000bc7a2ff6f0 RIP 00007ff669b6d6fc  [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:59)
  RSP 000000bc7a2ff700 RIP 00007ff669b693c9  [image code] com.oracle.svm.core.thread.VMOperationControl.guaranteeOkayToBlock(VMOperationControl.java:276)
  RSP 000000bc7a2ff730 RIP 00007ff669b12c58  [image code] com.oracle.svm.core.MonitorSupport.monitorEnter(MonitorSupport.java:138)
  RSP 000000bc7a2ff750 RIP 00007ff669b4abbf  [image code] com.oracle.svm.core.jdk.SplittableRandomAccessors.initialize(JavaUtilSubstitutions.java:267)
  RSP 000000bc7a2ff7c0 RIP 00007ff669cff66a  [image code] com.oracle.svm.core.jdk.SplittableRandomAccessors.getDefaultGen(JavaUtilSubstitutions.java:260)
  RSP 000000bc7a2ff7c0 RIP 00007ff669cff66a  [image code] java.util.SplittableRandom.<init>(SplittableRandom.java:378)
  RSP 000000bc7a2ff7e0 RIP 00007ff669b475d5  [image code] com.oracle.svm.core.jdk.IdentityHashCodeSupport.generateHashCode(IdentityHashCodeSupport.java:43)
  RSP 000000bc7a2ff800 RIP 00007ff669c13a37  [image code] java.lang.System.identityHashCode(System.java:309)
  RSP 000000bc7a2ff830 RIP 00007ff669bf5819  [image code] java.lang.Object.hashCodeSubst(Object.java:102)
  RSP 000000bc7a2ff850 RIP 00007ff669cdf106  [image code] java.util.HashMap.hash(HashMap.java:339)
  RSP 000000bc7a2ff870 RIP 00007ff669cdf78b  [image code] java.util.HashMap.put(HashMap.java:607)
  RSP 000000bc7a2ff8a0 RIP 00007ff669b633f6  [image code] com.oracle.svm.core.thread.JavaThreads.lambda$getAllStackTraces$1(JavaThreads.java:539)
  RSP 000000bc7a2ff8d0 RIP 00007ff669b61430  [image code] com.oracle.svm.core.thread.JavaThreads$$Lambda$91a7d87fc99e4d13115449c8034607abad6591ed.invoke(Unknown Source)
  RSP 000000bc7a2ff8f0 RIP 00007ff669b64fd4  [image code] com.oracle.svm.core.thread.JavaVMOperation$ThunkOperation.operate(JavaVMOperation.java:132)
  RSP 000000bc7a2ff910 RIP 00007ff669b65618  [image code] com.oracle.svm.core.thread.JavaVMOperation.operate(JavaVMOperation.java:115)
  RSP 000000bc7a2ff930 RIP 00007ff669b67fb4  [image code] com.oracle.svm.core.thread.VMOperation.execute(VMOperation.java:89)
  RSP 000000bc7a2ff980 RIP 00007ff669b684ca  [image code] com.oracle.svm.core.thread.VMOperationControl$WorkQueues.drain(VMOperationControl.java:532)
  RSP 000000bc7a2ff9c0 RIP 00007ff669b68c1b  [image code] com.oracle.svm.core.thread.VMOperationControl$WorkQueues.executeAllQueuedVMOperations(VMOperationControl.java:486)
  RSP 000000bc7a2ffa10 RIP 00007ff669b68a24  [image code] com.oracle.svm.core.thread.VMOperationControl$WorkQueues.enqueueAndExecute(VMOperationControl.java:429)
  RSP 000000bc7a2ffa40 RIP 00007ff669b692a1  [image code] com.oracle.svm.core.thread.VMOperationControl.enqueue(VMOperationControl.java:249)
  RSP 000000bc7a2ffa80 RIP 00007ff669b65400  [image code] com.oracle.svm.core.thread.VMOperationControl.enqueue(VMOperationControl.java:213)
  RSP 000000bc7a2ffa80 RIP 00007ff669b65400  [image code] com.oracle.svm.core.thread.JavaVMOperation.enqueue(JavaVMOperation.java:69)
  RSP 000000bc7a2ffa80 RIP 00007ff669b65400  [image code] com.oracle.svm.core.thread.JavaVMOperation.enqueueBlockingSafepoint(JavaVMOperation.java:104)
  RSP 000000bc7a2ffaa0 RIP 00007ff669b6297c  [image code] com.oracle.svm.core.thread.JavaThreads.getAllStackTraces(JavaThreads.java:537)
  RSP 000000bc7a2ffac0 RIP 00007ff669b11569  [image code] java.lang.Thread.getAllStackTraces(Thread.java:385)
  RSP 000000bc7a2ffac0 RIP 00007ff669b11569  [image code] AllStackTraces.printAllStackTraces(AllStackTraces.java:29)
  RSP 000000bc7a2ffaf0 RIP 00007ff669b1131b  [image code] AllStackTraces.main(AllStackTraces.java:24)
  RSP 000000bc7a2ffb20 RIP 00007ff669b2639d  [image code] com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
  RSP 000000bc7a2ffb20 RIP 00007ff669b2639d  [image code] com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
  RSP 000000bc7a2ffb20 RIP 00007ff669b2639d  [image code] com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(IsolateEnterStub.java:0)

Full Stacktrace for VMThread 000001bfac3bb140:

  RSP 000000bc7a5ff5d0 RIP 00007ff669b6eab5  [image code] com.oracle.svm.core.windows.headers.SynchAPI.WaitForSingleObject(SynchAPI.java)
  RSP 000000bc7a5ff5d0 RIP 00007ff669b6eab5  [image code] com.oracle.svm.core.windows.WindowsParkEvent.condTimedWait(WindowsJavaThreads.java:226)
  RSP 000000bc7a5ff640 RIP 00007ff669b63ddd  [image code] com.oracle.svm.core.thread.JavaThreads.sleep(JavaThreads.java:706)
  RSP 000000bc7a5ff6e0 RIP 00007ff669c1503b  [image code] java.lang.Thread.sleep(Thread.java:349)
  RSP 000000bc7a5ff700 RIP 00007ff669c14782  [image code] AllStackTraces$1.run(AllStackTraces.java:12)
  RSP 000000bc7a5ff700 RIP 00007ff669c14782  [image code] java.lang.Thread.run(Thread.java:834)
  RSP 000000bc7a5ff720 RIP 00007ff669b647de  [image code] com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:497)
  RSP 000000bc7a5ff750 RIP 00007ff669b6d9cf  [image code] com.oracle.svm.core.windows.WindowsJavaThreads.osThreadStartRoutine(WindowsJavaThreads.java:136)
  RSP 000000bc7a5ff7a0 RIP 00007ff669b26729  [image code] com.oracle.svm.core.code.IsolateEnterStub.WindowsJavaThreads_osThreadStartRoutine_4bc03aa26f8cdfc97ebd54050e8ae4bce1023851(IsolateEnterStub.java:0)

[Native image heap boundaries:
  ReadOnly Primitives: 0x1bfac680008 .. 0x1bfac7e6188
  ReadOnly References: 0x1bfac7e6418 .. 0x1bfac8d0e88
  Writable Primitives: 0x1bfac8d1000 .. 0x1bfac9338a8
  Writable References: 0x1bfac9338c0 .. 0x1bfaca034a8]


[Heap:
  [Young generation:
    [youngSpace:
      aligned: 0/0 unaligned: 0/0]]
  [Old generation:
    [fromSpace:
      aligned: 0/0 unaligned: 0/0]
    [toSpace:
      aligned: 0/0 unaligned: 0/0]
    ]
  [Unused:
    aligned: 0/0]]

Fatal error: Should not reach here: Not okay to block.```
@tiainen
Copy link
Author

tiainen commented Jan 27, 2020

This is a sample Java program that produces the error.

import java.util.Map;
import java.util.Map.Entry;

public class AllStackTraces {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) { 
                    try {
                        Thread.sleep(10000);
                    } catch (InterruptedException e) {
                        break;
                    }
                }
            }
        }, "Sleeping Thread");
        thread.setDaemon(true);
        thread.start();

        for (int i = 0; i < 5; i++) {
            Thread.sleep(1000);
            printAllStackTraces();
        }
    }

    public static void printAllStackTraces() {
        Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
        System.out.println("Number of threads: " + traces.size());
    }
}

When you comment the line with thread.start(), the application does not fail.

@olpaw olpaw added the bug label Jan 27, 2020
@arodionov arodionov self-assigned this Mar 2, 2020
@vjovanov
Copy link
Member

@arodionov has this been merged?

@tsatatwer
Copy link

tsatatwer commented Apr 23, 2020

@cstancu any word on this issue it is vital for the windows javafx native image support @tiainen doing great efforts on that .....so please put it on high priority do not put it on hold sorry to say that BUT several javafx native image issues in freeze again I am sorry to say that this issue opened on Jan 27.

@arodionov
Copy link

@arodionov has this been merged?

Yes, it has been merged.

@tiainen
Copy link
Author

tiainen commented Apr 23, 2020

I can confirm that it indeed works now.

@akainz
Copy link

akainz commented Aug 24, 2023

Hi, I'm on graalvm-community-openjdk-17.0.7+7.1 and this still seems to be an issue.

When calling Thread.getAllStackTraces() the native image sometimes crashes. We call the method continuously every second and this happen.

No Java synchronization must be performed within a VMOperation: if the object is already locked, the VM is deadlocked
Fatal error: Should not reach here: Not okay to block.

Stacktrace for the failing thread 0x000001ecb3ccbc80:
  SP 0x000000488acfef90 IP 0x00007ff77144ad40  [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shutdown(VMErrorSubstitutions.java:119)
  SP 0x000000488acfef90 IP 0x00007ff77144ad40  [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shouldNotReachHere(VMErrorSubstitutions.java:112)
  SP 0x000000488acfefc0 IP 0x00007ff7715d3344  [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:68)
  SP 0x000000488acfefd0 IP 0x00007ff7715cdd59  [image code] com.oracle.svm.core.thread.VMOperationControl.guaranteeOkayToBlock(VMOperationControl.java:365)
  SP 0x000000488acfeff0 IP 0x00007ff7715333fb  [image code] com.oracle.svm.core.monitor.MultiThreadedMonitorSupport.slowPathMonitorEnter(MultiThreadedMonitorSupport.java:211)
  SP 0x000000488acff010 IP 0x00007ff77267f3ab  [image code] java.lang.NullPointerException.fillInStackTrace(NullPointerException.java:84)
  SP 0x000000488acff030 IP 0x00007ff7715c272a  [image code] java.lang.Throwable.<init>(Throwable.java:256)
  SP 0x000000488acff030 IP 0x00007ff7715c272a  [image code] java.lang.Exception.<init>(Exception.java:55)
  SP 0x000000488acff030 IP 0x00007ff7715c272a  [image code] java.lang.RuntimeException.<init>(RuntimeException.java:52)
  SP 0x000000488acff030 IP 0x00007ff7715c272a  [image code] java.lang.NullPointerException.<init>(NullPointerException.java:59)
  SP 0x000000488acff030 IP 0x00007ff7715c272a  [image code] com.oracle.svm.core.snippets.ImplicitExceptions.throwNewNullPointerException(ImplicitExceptions.java:273)
  SP 0x000000488acff1b0 IP 0x00007ff7715c6b1b  [image code] com.oracle.svm.core.thread.PlatformThreads.getIsolateThread(PlatformThreads.java:309)
  SP 0x000000488acff1d0 IP 0x00007ff7715c6c88  [image code] com.oracle.svm.core.thread.PlatformThreads.getStackTraceAtSafepoint(PlatformThreads.java:846)
  SP 0x000000488acff1f0 IP 0x00007ff771445ed8  [image code] com.oracle.svm.core.jdk.StackTraceUtils.getStackTraceAtSafepoint(StackTraceUtils.java:92)
  SP 0x000000488acff200 IP 0x00007ff7715c6447  [image code] com.oracle.svm.core.thread.PlatformThreads$GetAllStackTracesOperation.operate(PlatformThreads.java:1058)
  SP 0x000000488acff240 IP 0x00007ff7715c5612  [image code] com.oracle.svm.core.thread.JavaVMOperation.operate(JavaVMOperation.java:132)
  SP 0x000000488acff250 IP 0x00007ff7715cc420  [image code] com.oracle.svm.core.thread.VMOperation.execute(VMOperation.java:104)
  SP 0x000000488acff2a0 IP 0x00007ff7715ccd98  [image code] com.oracle.svm.core.thread.VMOperationControl$WorkQueues.drain(VMOperationControl.java:637)
  SP 0x000000488acff2e0 IP 0x00007ff7715cd835  [image code] com.oracle.svm.core.thread.VMOperationControl$WorkQueues.executeAllQueuedVMOperations(VMOperationControl.java:591)
  SP 0x000000488acff330 IP 0x00007ff7715cd5a4  [image code] com.oracle.svm.core.thread.VMOperationControl$WorkQueues.enqueueAndExecute(VMOperationControl.java:527)
  SP 0x000000488acff390 IP 0x00007ff7715cdc35  [image code] com.oracle.svm.core.thread.VMOperationControl.enqueue(VMOperationControl.java:318)
  SP 0x000000488acff3c0 IP 0x00007ff7715c6a3a  [image code] com.oracle.svm.core.thread.VMOperationControl.enqueue(VMOperationControl.java:275)
  SP 0x000000488acff3c0 IP 0x00007ff7715c6a3a  [image code] com.oracle.svm.core.thread.JavaVMOperation.enqueue(JavaVMOperation.java:81)
  SP 0x000000488acff3c0 IP 0x00007ff7715c6a3a  [image code] com.oracle.svm.core.thread.PlatformThreads.getAllStackTraces(PlatformThreads.java:859)
  SP 0x000000488acff3e0 IP 0x00007ff770983c73  [image code] java.lang.Thread.getAllStackTraces(Thread.java:622)
  SP 0x000000488acff3e0 IP 0x00007ff770983c73  [image code] com.xxxxx.backend.controller.Management.dumpTraces(Management.java:216)
  SP 0x000000488acff3f0 IP 0x00007ff7715a26d0  [image code] com.oracle.svm.core.reflect.ReflectionAccessorHolder.invoke_e7f13719c563a2b6487c56ef2fb223e47172f1db(ReflectionAccessorHolder.java:0)
  SP 0x000000488acff400 IP 0x00007ff7715af810  [image code] com.oracle.svm.core.reflect.SubstrateMethodAccessor.invoke(SubstrateMethodAccessor.java:115)
  SP 0x000000488acff430 IP 0x00007ff777a717bd  [image code] java.lang.reflect.Method.invoke(Method.java:568)
  SP 0x000000488acff430 IP 0x00007ff777a717bd  [image code] org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84)
  SP 0x000000488acff460 IP 0x00007ff777a6a570  [image code] org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
  SP 0x000000488acff490 IP 0x00007ff772c7ac90  [image code] java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
  SP 0x000000488acff4b0 IP 0x00007ff772c8df5a  [image code] java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
  SP 0x000000488acff520 IP 0x00007ff772ca90c3  [image code] java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
  SP 0x000000488acff540 IP 0x00007ff772cb78d3  [image code] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
  SP 0x000000488acff590 IP 0x00007ff772cb39ea  [image code] java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
  SP 0x000000488acff5a0 IP 0x00007ff7726c7b15  [image code] java.lang.Thread.run(Thread.java:833)
  SP 0x000000488acff5b0 IP 0x00007ff7715c97e3  [image code] com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807)
  SP 0x000000488acff5e0 IP 0x00007ff7715d57c0  [image code] com.oracle.svm.core.windows.WindowsPlatformThreads.osThreadStartRoutine(WindowsPlatformThreads.java:179)
  SP 0x000000488acff610 IP 0x00007ff7714022e0  [image code] com.oracle.svm.core.code.IsolateEnterStub.WindowsPlatformThreads_osThreadStartRoutine_f4fafac97a2a1cec9ad0f558081a3e37efc7fb96(IsolateEnterStub.java:0)

I'll attach the full diagnostic info below.
stack.txt

@akainz
Copy link

akainz commented Aug 31, 2023

@arodionov sorry should I open my own bug or is are discussions seen here?

@arodionov
Copy link

arodionov commented Aug 31, 2023

@akainz I suggest to reopen the current issue, and in addition to stack trace also provide a simple reproducer.
Perhaps you could also check if this issue is reproducible in newer versions of GraalVM.

@arodionov arodionov removed their assignment Aug 31, 2023
@akainz
Copy link

akainz commented Sep 2, 2023

@arodionov ok I will see if I can replicate it in the 21 release and if it's still there I'll open a new issue.

@radovanradic
Copy link
Member

We started getting this error. It seems it started after upgrading to vertx-oracle-client 4.5.0 that pulls Oracle ojdbc 23.3.0.23.09 and it has this code in class oracle.jdbc.driver.GeneratedPhysicalConnection in method getApplicationProgramName

static String getApplicationProgramName(final String defaultValue) {
        return (String)AccessController.doPrivileged(new PrivilegedAction<String>() {
            public String run() {
                String sessionProgram = defaultValue;
                Collection<StackTraceElement[]> stacks = Thread.getAllStackTraces().values();
                ...

we have reactive tests and X number of threads accessing db so the test is failing randomly in GraalVM with the error reported in this issue.

@vjovanov
Copy link
Member

vjovanov commented Dec 7, 2023

Which version of GraalVM is it? If it fails with the latest, could you please open a ticket?

@radovanradic
Copy link
Member

It is latest it seems: Java version: 21.0.1+12, vendor version: Oracle GraalVM 21.0.1+12.1

I will open the ticket, just to say again - it is intermittent, does not fail every time.

@vjovanov
Copy link
Member

vjovanov commented Dec 7, 2023

Thanks for reporting! This is a very important issue.

@radovanradic
Copy link
Member

Created issue #7979

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants