graalvm环境 jdbc-sqlite#close方法报错

问题描述

graalvm-21.1.0环境下,数据存储用的嵌入式数据库sqlite没有使用连接池,开发测试都正常但是打包成exe镜像后运行报错

[ [ SubstrateSegfaultHandler caught a segfault. ] ]

General Purpose Register Set values:

  RAX 000002001b8d4010

  RBX 000002001b15a180

  RCX 0000000000001100

  RDX 0000000000000003

  RBP 0000000000000000

  RSI 00000000004a53c0

  RDI 0000000000000003

  RSP 000000c18b3cfa80

  R8  0000000000000000

  R9  0000000000000000

  R10 000002001b500000

  R11 000002001b15a180

  R12 00007ff667aca1ec

  R13 000000c18b3cfb10

  R14 000002001b500000

  R15 000002001b15a180

  EFL 0000000000010206

  RIP 000000006774343e

JavaFrameAnchor dump:

  Anchor 000000c18b3cfb10 LastJavaSP 000000c18b3cfad0 LastJavaIP 00007ff667aca1ec

TopFrame info:

  Does not look like a Java Frame. Use JavaFrameAnchors to find LastJavaSP:

  Found matching Anchor:000000c18b3cfb10

  LastJavaSP 000000c18b3cfad0

  LastJavaIP 00007ff667aca1ec

VMThreads info:

  VMThread 000002001b15a180  STATUS_IN_JAVA (safepoints disabled)  java.lang.Thread@0x2001bae2fd8

VM Thread State for current thread 000002001b15a180:

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

    000002001b15a180: 000002001b8d4010

  8 (8 bytes): com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.stackBoundaryTL = (Word) 831263711232  000000c18b2da000

  16 (4 bytes): com.oracle.svm.core.thread.Safepoint.safepointRequested = (int) 2119965309  7e5c1a7d

  20 (4 bytes): com.oracle.svm.core.thread.VMThreads$StatusSupport.statusTL = (int) 1  00000001

  24 (32 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.regularTLAB = (bytes)

    000002001b15a198: 000002001c900000 000002001ca00000

    000002001b15a1a8: 000002001c961138 0000000000000000

  56 (8 bytes): com.oracle.svm.core.thread.JavaThreads.currentThread = (Object) java.lang.Thread  000002001bae2fd8

  64 (8 bytes): com.oracle.svm.core.stack.JavaFrameAnchors.lastAnchor = (Word) 831264717584  000000c18b3cfb10

  72 (8 bytes): com.oracle.svm.core.heap.NoAllocationVerifier.openVerifiers = (Object) null

  80 (8 bytes): com.oracle.svm.core.identityhashcode.IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) java.util.SplittableRandom  000002001c4034e8

  88 (8 bytes): com.oracle.svm.core.snippets.ExceptionUnwind.currentException = (Object) null

  96 (8 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.activeTimer = (Object) null

  104 (8 bytes): com.oracle.svm.graal.isolated.IsolatedCompileClient.currentClient = (Object) null

  112 (8 bytes): com.oracle.svm.graal.isolated.IsolatedCompileContext.currentContext = (Object) null

  120 (8 bytes): com.oracle.svm.jni.JNIObjectHandles.handles = (Object) com.oracle.svm.core.handles.ThreadLocalHandles  000002001c401430

  128 (8 bytes): com.oracle.svm.jni.JNIThreadLocalPendingException.pendingException = (Object) java.lang.NoSuchFieldError  000002001c9602f8

  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.thread.VMThreads.IsolateTL = (Word) 2199481483264  000002001b500000

  160 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadHandleTL = (Word) 204  00000000000000cc

  168 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadIdTL = (Word) 11192  0000000000002bb8

  176 (8 bytes): com.oracle.svm.core.thread.VMThreads.nextTL = (Word) 0  0000000000000000

  184 (8 bytes): com.oracle.svm.core.thread.VMThreads.unalignedIsolateThreadMemoryTL = (Word) 2199477657984  000002001b15a180

  192 (4 bytes): com.oracle.svm.core.graal.snippets.StackOverflowCheckImpl.yellowZoneStateTL = (int) 1  00000001

  196 (4 bytes): com.oracle.svm.core.snippets.ImplicitExceptions.implicitExceptionsAreFatal = (int) 0  00000000

  200 (4 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.currentPauseDepth = (int) 0  00000000

  204 (4 bytes): com.oracle.svm.core.thread.VMThreads$ActionOnExitSafepointSupport.actionTL = (int) 0  00000000

  208 (4 bytes): com.oracle.svm.core.thread.VMThreads$ActionOnTransitionToJavaSupport.actionTL = (int) 0  00000000

  212 (4 bytes): com.oracle.svm.core.thread.VMThreads$StatusSupport.safepointsDisabledTL = (int) 1  00000001

VMOperation dump:

  No VMOperation in progress

  The 10 most recent VM operation status changes (oldest first):

Dump Counters:

Raw Stacktrace:

  000000c18b3cfa80: 000000011c95fcb8 00007ff666f309de

  000000c18b3cfa90: 00000000677433dd 00007ff666f4466b

  000000c18b3cfaa0: 000000021c957170 000002001bae2fd8

  000000c18b3cfab0: 0000000001457170 0000000000000060

  000000c18b3cfac0: 0000000000000000 00007ff667aca1ff

  000000c18b3cfad0: 000002001b500000 000002001c95b3b8

  000000c18b3cfae0: 000002001c95fad8 00007ff666f309de

  000000c18b3cfaf0: 000002001c957170 0000000000000003

Stacktrace Stage 0:

  SP 000000c18b3cfa80 IP 000000006774343e  IP is not within Java code. Trying frame anchor of last Java frame instead.

  SP 000000c18b3cfad0 IP 00007ff667aca1ec  FrameSize 96

  SP 000000c18b3cfb30 IP 00007ff667ac535a  FrameSize 64

  SP 000000c18b3cfb70 IP 00007ff667ab98ec  FrameSize 16

  SP 000000c18b3cfb80 IP 00007ff666ee5874  FrameSize 160

  SP 000000c18b3cfc20 IP 00007ff666ee0c4d  FrameSize 96

  SP 000000c18b3cfc80 IP 00007ff666f125fe  FrameSize 304

Stacktrace Stage 1:

  SP 000000c18b3cfa80 IP 000000006774343e  IP is not within Java code. Trying frame anchor of last Java frame instead.

  SP 000000c18b3cfad0 IP 00007ff667aca1ec  com.oracle.svm.core.code.CodeInfo@0x2001ba70710 name = image code

  SP 000000c18b3cfb30 IP 00007ff667ac535a  com.oracle.svm.core.code.CodeInfo@0x2001ba70710 name = image code

  SP 000000c18b3cfb70 IP 00007ff667ab98ec  com.oracle.svm.core.code.CodeInfo@0x2001ba70710 name = image code

  SP 000000c18b3cfb80 IP 00007ff666ee5874  com.oracle.svm.core.code.CodeInfo@0x2001ba70710 name = image code

  SP 000000c18b3cfc20 IP 00007ff666ee0c4d  com.oracle.svm.core.code.CodeInfo@0x2001ba70710 name = image code

  SP 000000c18b3cfc80 IP 00007ff666f125fe  com.oracle.svm.core.code.CodeInfo@0x2001ba70710 name = image code

Stacktrace Stage 2:

  SP 000000c18b3cfa80 IP 000000006774343e  IP is not within Java code. Trying frame anchor of last Java frame instead.

  SP 000000c18b3cfad0 IP 00007ff667aca1ec  [image code] org.sqlite.core.NativeDB.free_functions(NativeDB.java)

  SP 000000c18b3cfb30 IP 00007ff667ac535a  [image code] org.sqlite.core.DB.close(DB.java:228)

  SP 000000c18b3cfb70 IP 00007ff667ab98ec  [image code] org.sqlite.SQLiteConnection.close(SQLiteConnection.java:381)

  SP 000000c18b3cfb80 IP 00007ff666ee5874  [image code] com.chinadaas.datasafe.client.service.LogServiceImpl.getLogs(LogServiceImpl.java:56)

  SP 000000c18b3cfc20 IP 00007ff666ee0c4d  [image code] com.chinadaas.datasafe.client.Application.main(Application.java:62)

  SP 000000c18b3cfc80 IP 00007ff666f125fe  [image code] com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:146)

  SP 000000c18b3cfc80 IP 00007ff666f125fe  [image code] com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:182)

  SP 000000c18b3cfc80 IP 00007ff666f125fe  [image code] com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(IsolateEnterStub.java:0)

[Heap settings and statistics:

  Supports isolates: true

  Object reference size: 8

  Incremental collections: 0

  Complete collections: 0]

[Native image heap boundaries:

  ReadOnly Primitives: 0x2001b501028 .. 0x2001b738708

  ReadOnly References: 0x2001b738718 .. 0x2001b8d3400

  ReadOnly Relocatables: 0x2001b8d4000 .. 0x2001b9e4098

  Writable Primitives: 0x2001b9e5000 .. 0x2001ba8fb38

  Writable References: 0x2001ba8fb48 .. 0x2001bda7ab8

  Writable Huge: 0x0 .. 0x0

  ReadOnly Huge: 0x2001be00030 .. 0x2001c2e5aa8]

[Heap:

  [Young generation:

    [Eden:

      [edenSpace:

        aligned: 0/0 unaligned: 0/0]]

    [Survivors:

      ]]

  [Old generation:

    [oldFromSpace:

      aligned: 0/0 unaligned: 0/0]

    [oldToSpace:

      aligned: 0/0 unaligned: 0/0]

    ]

  [Unused:

    aligned: 0/0]]

Segfault detected, aborting process. Use runtime option -R:-InstallSegfaultHandler if you don't want to use SubstrateSegfaultHandler.

解决办法

根据报错信息可以看到最终是因为调用connect.close方法导致得,而这个方法最终又调用了org.sqlite.core.DB#free_functions而free_functions方法是一个native方法,作用是删除用户定义函数使用的内存,猜测是在释放内存得时候地址计算错误或者是什么原因导致。具体原因不清楚有知道的大佬还请指教,我们最后解决办法是:

1. 更换纯java数据库hypersql

2. 继续使用sqlite数据库,但是不调用close方法

你可能感兴趣的:(graalvm环境 jdbc-sqlite#close方法报错)