oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.29k stars 1.63k forks source link

native-image-agent failed with "java.lang.String cannot be cast to java.util.List" #1286

Closed ziyilin closed 5 years ago

ziyilin commented 5 years ago

I got a Fatal error: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List while running java program with RC16's native-image-agent. P.S. I tried to use the lastest 19.0's agent, but it is not shipped with https://github.com/oracle/graal/releases/download/vm-19.0.0/graalvm-ce-linux-amd64-19.0.0.tar.gz. How to build native-image-agent if it is not come along with the release?

How to reproduce:

  1. Clone project https://github.com/sofastack/sofa-registry
  2. Modify a configuration file

    git diff server/server/meta/src/main/resources/application.properties
    diff --git a/server/server/meta/src/main/resources/application.properties b/server/server/meta/src/main/resources/application
    index 2449af5..b6b8d61 100644
    --- a/server/server/meta/src/main/resources/application.properties
    +++ b/server/server/meta/src/main/resources/application.properties
    @@ -1,6 +1,6 @@
    spring.main.banner-mode=LOG
    -#nodes.metaNode=<data_center>:<meta_ip>
    -#nodes.localDataCenter=<data_center>
    +nodes.metaNode=demo:localhost
    +nodes.localDataCenter=demo
    
    #meta.server.logging.level=INFO
    #meta.server.logging.home=/home/admin/logs/registry/meta
  3. run mvn clean install -DskipTests under project's home.
  4. run graalvm-ce-1.0.0-rc16/bin/java -agentlib:native-image-agent=config-output-dir=configs -jar server/server/meta/target/registry-server-meta-executable.jar.

Error message:

Fatal error: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
    at com.oracle.svm.configure.trace.ReflectionProcessor.processEntry(ReflectionProcessor.java:154)
    at com.oracle.svm.configure.trace.TraceProcessor.processEntry(TraceProcessor.java:110)
    at com.oracle.svm.agent.TraceProcessorWriterAdapter.traceEntry(TraceProcessorWriterAdapter.java:46)
    at com.oracle.svm.agent.TraceWriter.traceCall(TraceWriter.java:92)
    at com.oracle.svm.agent.BreakpointInterceptor.traceBreakpoint(BreakpointInterceptor.java:110)
    at com.oracle.svm.agent.BreakpointInterceptor.getConstructor(BreakpointInterceptor.java:259)
    at com.oracle.svm.agent.BreakpointInterceptor.onBreakpoint(BreakpointInterceptor.java:498)

JavaFrameAnchor dump:

  No anchors

TopFrame info:

  Lookup TotalFrameSize in CodeInfoTable:
  SourceTotalFrameSize 32

VMThreads info:

  VMThread 00007faa74009d50  STATUS_IN_NATIVE  java.lang.Thread@0x7faa9c801030
  VMThread 00007faa7800aa20  STATUS_IN_NATIVE  java.lang.Thread@0x7faa9d2011e0
  VMThread 00007faabc005300  STATUS_IN_JAVA (safepoints disabled)  java.lang.Thread@0x7faac2001618

VM Thread State for current thread 00007faabc005300:

  0 (8 bytes): com.oracle.svm.jni.JNIThreadLocalEnvironment.jniFunctions = (bytes)
    00007faabc005300: 0000000000000000

  8 (32 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.pinnedTLAB = (bytes)
    00007faabc005308: 0000000000000000 0000000000000000
00007faabc005318: 0000000000000000 0000000000000000

  40 (32 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.regularTLAB = (bytes)
    00007faabc005328: 00007faa4ca00000 00007faa4cb00000
    00007faabc005338: 00007faa4cafc970 0000000000000000

  72 (8 bytes): com.oracle.svm.core.genscavenge.PinnedAllocatorImpl.openPinnedAllocator = (Object) null
  80 (8 bytes): com.oracle.svm.core.heap.NoAllocationVerifier.openVerifiers = (Object) null
  88 (8 bytes): com.oracle.svm.core.jdk.IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) null
  96 (8 bytes): com.oracle.svm.core.snippets.SnippetRuntime.currentException = (Object) null
  104 (8 bytes): com.oracle.svm.core.thread.JavaThreads.currentThread = (Object) java.lang.Thread  00007faac2001618
  112 (8 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.activeTimer = (Object) null
  120 (8 bytes): com.oracle.svm.jni.JNIThreadLocalHandles.handles = (Object) null
  128 (8 bytes): com.oracle.svm.jni.JNIThreadLocalPendingException.pendingException = (Object) null
  136 (8 bytes): com.oracle.svm.jni.JNIThreadLocalPinnedObjects.pinnedObjectsListHead = (Object) null
  144 (8 bytes): com.oracle.svm.jni.JNIThreadOwnedMonitors.ownedMonitors = (Object) null
  152 (8 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.freeList = (Word) 0  0000000000000000
  160 (8 bytes): com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.stackBoundaryTL = (Word) 1  0000000000000001
  168 (8 bytes): com.oracle.svm.core.stack.JavaFrameAnchors.lastAnchor = (Word) 0  0000000000000000
  176 (8 bytes): com.oracle.svm.core.thread.VMThreads.IsolateTL = (Word) 140371389452288  00007faac2ce1000
  184 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadIdTL = (Word) 140371435075328  00007faac5863700
  192 (8 bytes): com.oracle.svm.core.thread.VMThreads.nextTL = (Word) 0  0000000000000000
  200 (4 bytes): com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.yellowZoneStateTL = (int) -16843010  fefefefe
  204 (4 bytes): com.oracle.svm.core.snippets.ImplicitExceptions.implicitExceptionsAreFatal = (int) 0  00000000
  208 (4 bytes): com.oracle.svm.core.thread.Safepoint.safepointRequested = (int) -592058  fff6f746
  212 (4 bytes): com.oracle.svm.core.thread.Safepoint.safepointRequestedValueBeforeSafepoint = (int) 0  00000000
  216 (4 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.currentPauseDepth = (int) 0  00000000
  220 (4 bytes): com.oracle.svm.core.thread.VMOperationControl.isLockOwner = (int) 0  00000000
  224 (4 bytes): com.oracle.svm.core.thread.VMThreads$StatusSupport.safepointsDisabledTL = (int) 1  00000001
  228 (4 bytes): com.oracle.svm.core.thread.VMThreads$StatusSupport.statusTL = (int) 1  00000001
VMOperation dump:

  No VMOperation in progress

Dump Counters:
Raw Stacktrace:

  00007faac58614a0: 0000000000000000 00007faac2ce1000
  00007faac58614b0: 00007faa4cafbf08 00007faac296ee0f
  00007faac58614c0: 00007faac200a298 00007faac28e3c18
  00007faac58614d0: 00007faac5861500 00007faac5861590
  00007faac58614e0: 00000000fffffffe 00007faabc31ef38
  00007faac58614f0: 00007faac2ce1048 00007faac2eeed08
  00007faac5861500: 00007faabc22d3b8 00007faabc00c9e0
  00007faac5861510: 000000000000003e 00007faac2ce1000
  00007faac5861520: 000000e8bc00b270 00007faac2914d5f
  00007faac5861530: 00007faac58615a0 00007faac43c619a
  00007faac5861540: 00007faac01e9bd0 00007faabc00c800
  00007faac5861550: 0000000000000000 00007faabc22d3b8
  00007faac5861560: 00007faabc31ef30 00007faabc00c9e0
  00007faac5861570: 00007faabc005c00 00007faac5861760
  00007faac5861580: 00007faac58616c0 00007faabc1ed650
  00007faac5861590: 00007faac5861640 00007faac01e9ba8
  00007faac58615a0: 00007faabc00c800 00007faac43cc9e5
  00007faac58615b0: 0000000100001df8 00007faac5861680
  00007faac58615c0: 00007faac5861630 00007faabc22d3b8
  00007faac58615d0: 00000002c5861660 00007faabc005c00
  00007faac58615e0: 00007faac5861600 00007faac5861610
 00007faac58615f0: 00007faac5861620 00007faabc00c800
  00007faac5861600: 00007faac01e9bd0 00007faabc00c800
  00007faac5861610: 00007faac01e9bd0 00007faabc00c800
  00007faac5861620: 00007faac01e9bd0 00007faabc00c800
  00007faac5861630: 00007faac01e9bd0 00007faabc00c800
  00007faac5861640: 00007faac01e9bd0 00007faabc00c800
  00007faac5861650: 00007faabc00c800 00007faabc00c9e0
  00007faac5861660: 00007faac5860000 00007faabc31ef30
  00007faac5861670: 00007faabc22d3b8 0000000000000000
  00007faac5861680: 00007faabc00c800 00007faabc00b230
  00007faac5861690: 00007faabc00d1a0 00007faabc00d1d0
  00007faac58616a0: 00007faabc00d288 00000000000000d8
  00007faac58616b0: 00007faac5862290 00007faac427af9d
  00007faac58616c0: 00007faac01e9bd0 00007faabc00b1b0
  00007faac58616d0: 00007faabc00b530 00007faabc00b540
  00007faac58616e0: 00007faabc00b918 00000000000003d8
  00007faac58616f0: 00007faabc00c800 00007faabc00c800
  00007faac5861700: 00007faabc00b230 00007faabc00d1a0
  00007faac5861710: 00007faabc00d1d0 00007faabc00d288
  00007faac5861720: 00000000000000d8 00007faac5861680
  00007faac5861730: 00007faac01e9bd0 00007faabc00c800
  00007faac5861740: 0000000000000000 00007faac01e9ba8
  00007faac5861750: 00007faac5861808 00007faabc00c800
  00007faac5861760: 00007faac5861790 00007faac4279e0f
  00007faac5861770: 00000000000000ca 000000000000002a
  00007faac5861780: 0000000000000000 00007faac01e9ba8
  00007faac5861790: 00007faac58617f0 00007faaad030adb
00007faac58617a0: 0000000000000000 00007faaad030aa4
  00007faac58617b0: 00007faac58617b0 00007faac01e9ba8
  00007faac58617c0: 00007faac5861808 00007faac028b138
  00007faac58617d0: 0000000000000000 00007faac01e9bd0
  00007faac58617e0: 0000000000000000 00007faac5861800
  00007faac58617f0: 00007faac5861860 00007faaad007de0
  00007faac5861800: 0000000000000000 00000000d8172d20
  00007faac5861810: 0000000000000001 00000000d980c140
  00007faac5861820: 00007faac5861810 00007faa4774d25b
  00007faac5861830: 00007faac58618b0 00007faa4774e690
  00007faac5861840: 0000000000000000 00007faa4774d330
  00007faac5861850: 00007faac5861800 00007faac5861898
  00007faac5861860: 00007faac58618f8 00007faaad007eb4
  00007faac5861870: 0000000000000000 0000000000000000
  00007faac5861880: 00000000d8172d20 00000000d980c140
  00007faac5861890: 0000000000000000 00000000d780a800

Stacktrace Stage0:

  RSP 00007faac58614a0 RIP 00007faac296ee69 FrameSize 32
  RSP 00007faac58614c0 RIP 00007faac296ee0f FrameSize 16
  RSP 00007faac58614d0 RIP 00007faac28e3c18 FrameSize 96
  RSP 00007faac5861530 RIP 00007faac2914d5f FrameSize 1

Stacktrace Stage1:

  RSP 00007faac58614a0 RIP 00007faac296ee69  com.oracle.svm.core.code.ImageCodeInfo@0x7faac2f90a60 name = image code
  RSP 00007faac58614c0 RIP 00007faac296ee0f  com.oracle.svm.core.code.ImageCodeInfo@0x7faac2f90a60 name = image code
  RSP 00007faac58614d0 RIP 00007faac28e3c18  com.oracle.svm.core.code.ImageCodeInfo@0x7faac2f90a60 name = image code
  RSP 00007faac5861530 RIP 00007faac2914d5f  com.oracle.svm.core.code.ImageCodeInfo@0x7faac2f90a60 name = image code

Full Stacktrace:

  RSP 00007faac58614a0 RIP 00007faac296ee69  [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shutdown(VMErrorSubstitutions.java:112)
  RSP 00007faac58614a0 RIP 00007faac296ee69  [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:74)
  RSP 00007faac58614c0 RIP 00007faac296ee0f  [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:65)
  RSP 00007faac58614d0 RIP 00007faac28e3c18  [image code] com.oracle.svm.agent.BreakpointInterceptor.onBreakpoint(BreakpointInterceptor.java:502)
  RSP 00007faac5861530 RIP 00007faac2914d5f  [image code] com.oracle.svm.core.code.IsolateEnterStub.BreakpointInterceptor_onBreakpoint_eb6efcdcab5a3952595ed891216f22230f12aebb(IsolateEnterStub.java:0)

[Native image heap boundaries:
  ReadOnly Primitives: 0x7faac2ce1008 .. 0x7faac2eee398
  ReadOnly References: 0x7faac2eee4c0 .. 0x7faac2fd3e50
  Writable Primitives: 0x7faac2fd4000 .. 0x7faac3037948
  Writable References: 0x7faac3037960 .. 0x7faac30b0410]

[Heap:
  [Young generation:
    [youngSpace:
      aligned: 1044432/1 unaligned: 0/0
      aligned chunks:
        0x7faa47900000 (0x7faa47901030-0x7faa4794e200)]]
  [Old generation:
    [fromSpace:
      aligned: 0/0 unaligned: 0/0]
    [toSpace:
      aligned: 0/0 unaligned: 0/0]
    [pinnedFromSpace:
 aligned: 0/0 unaligned: 0/0]
    [pinnedToSpace:
      aligned: 0/0 unaligned: 0/0]]
  [Unused:
    aligned: 0/0]]

Fatal error: java.lang.ClassCastException: java.lang.String cannot be cast to java.util.List
ziyilin commented 5 years ago

solved in GraalVM-CE-19