graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
bartuka 2019-12-29T00:48:20.030100Z

after fixing my environment, everything went fine! Thanks

bartuka 2019-12-29T11:28:24.033800Z

I was trying to make SQLITE to work inside my native build, but I had no luck. First, I noticed that I was missing some JNI support and then I created this file:

[ {
    "name" : "org.sqlite.core.DB",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.core.DB$ProgressObserver",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.core.NativeDB",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.BusyHandler",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.Function",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.Function$Aggregate",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.Function$Window",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "java.lang.Throwable",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}, {
    "name" : "org.sqlite.ProgressHandler",
    "allPublicMethods" : true,
    "allPublicFields" : true,
    "allPublicConstructors" : true
}
]

bartuka 2019-12-29T11:28:57.034600Z

I was including each class that was raised as error when I tried to execute my code

bartuka 2019-12-29T11:29:49.035400Z

following this approach, as the error was changing, I thought I was making progress.. but the last error msg I got was this one:

bartuka 2019-12-29T11:29:49.035500Z

[ [ SubstrateSegfaultHandler caught signal 11 ] ]

General Purpose Register Set Values: 

  RAX 000055988aad3000
  RBX 0000000000000005
  RCX 0000000000000006
  RDX 0000000000000000
  RBP 000055988cb90eb0
  RSI 000000030097f298
  RDI 000055988cb90eb0
  RSP 00007fff9dd8b318
  R8 0000000000000026
  R9 0000000000000010
  R10 00007f43ef2cb368
  R11 0000559889ce3a10
  R12 0000000000000004
  R13 0000000000000046
  R14 000055988aad3000
  R15 000055988cb90eb0
  EFL 0000000000010206
  RIP 0000000000962eae
  

JavaFrameAnchor dump:

  Anchor 00007fff9dd8b3b0 LastJavaSP 00007fff9dd8b360 LastJavaIP 000055988a5e21d4
  
TopFrame info:

  Does not look like a Java Frame. Use JavaFrameAnchors to find LastJavaSP:
  Found matching Anchor:00007fff9dd8b3b0
  LastJavaSP 00007fff9dd8b360
  LastJavaIP 000055988a5e21d4
  
VMThreads info:

  VMThread 00007f43e8000b60  STATUS_IN_NATIVE  java.lang.Thread@0x7f43f4cb7cd8
  VMThread 00007f43f0000b60  STATUS_IN_NATIVE  java.lang.Thread@0x7f43f5e03398
  VMThread 000055988cb90eb0  STATUS_IN_JAVA (safepoints disabled)  java.lang.Thread@0x55988c20b950
  
VM Thread State for current thread 000055988cb90eb0:

  0 (8 bytes): com.oracle.svm.jni.JNIThreadLocalEnvironment.jniFunctions = (bytes) 
    000055988cb90eb0: 000055988b44a210
  
  8 (32 bytes): com.oracle.svm.core.genscavenge.ThreadLocalAllocation.regularTLAB = (bytes) 
    000055988cb90eb8: 00007f43ef200000 00007f43ef300000
    000055988cb90ec8: 00007f43ef2cb398 00007f43f537e000
    
  
  40 (8 bytes): com.oracle.svm.core.heap.NoAllocationVerifier.openVerifiers = (Object) null
  48 (8 bytes): com.oracle.svm.core.jdk.IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) java.util.SplittableRandom  00007f43f50e7fc0
  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  000055988c20b950
  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  00007f43f5e01520
  88 (8 bytes): com.oracle.svm.jni.JNIThreadLocalPendingException.pendingException = (Object) java.lang.NoSuchMethodError  00007f43ef2c8e38
  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) 140735833272320  00007fff9d597000
  128 (8 bytes): com.oracle.svm.core.stack.JavaFrameAnchors.lastAnchor = (Word) 140735841612720  00007fff9dd8b3b0
  136 (8 bytes): com.oracle.svm.core.thread.VMThreads.IsolateTL = (Word) 94113649995776  000055988aad3000
  144 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadHandleTL = (Word) 139929890987264  00007f43f7721d00
  152 (8 bytes): com.oracle.svm.core.thread.VMThreads.OSThreadIdTL = (Word) 139929890987264  00007f43f7721d00
  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) 1  00000001
  172 (4 bytes): com.oracle.svm.core.snippets.ImplicitExceptions.implicitExceptionsAreFatal = (int) 0  00000000
  176 (4 bytes): com.oracle.svm.core.thread.Safepoint.safepointRequested = (int) 2125651433  7eb2dde9
  180 (4 bytes): com.oracle.svm.core.thread.ThreadingSupportImpl.currentPauseDepth = (int) 0  00000000
  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:

  No VMOperation in progress
  
Dump Counters:

  
Raw Stacktrace:

  00007fff9dd8b318: 00007f43eef31d8e 0000001000000001
  00007fff9dd8b328: 000055988b23f360 000000000097f298
  00007fff9dd8b338: 0000000001738950 000000000000002a
  00007fff9dd8b348: 000055988a5e21d4 00007fff9dd8b3b0
  00007fff9dd8b358: 000055988a5e21ea 0000000000000024
  00007fff9dd8b368: 000055988a152efd 000055988aad3000
  00007fff9dd8b378: 00007f43ef2c5e10 00007f43ef2c5ca0
  00007fff9dd8b388: 0000000000000005 0000000000000004
  00007fff9dd8b398: 000055988cb90eb0 00007f43eef31d5a
  00007fff9dd8b3a8: 0000004600000001 000055988a5e21d4
  00007fff9dd8b3b8: 00007fff9dd8b360 0000000000000000
  00007fff9dd8b3c8: 000055988a5e2097 000000028b23c3a8
  00007fff9dd8b3d8: 0000559889bd7222 00007f43ef2c5ca0
  00007fff9dd8b3e8: 00007f43ef2b81c8 00000046ef2c5ca0
  00007fff9dd8b3f8: 000055988a5e0d5e 00007f43ef2b8238
  00007fff9dd8b408: 000055988b2699c0 000000018b268bb0
  00007fff9dd8b418: 000055988a5e616e 00007f43ef2b81c8
  00007fff9dd8b428: 00007f43ef2c5ca0 000000468b2488c0
  00007fff9dd8b438: 000055988a5d4b30 0000000000000010
  00007fff9dd8b448: 000055988a1580a1 0000000000000026
  00007fff9dd8b458: 00007f43ef2b48c0 00007f43ef2b82c0
  00007fff9dd8b468: 00007f43ef2b8238 00007f43ef2b4a60
  00007fff9dd8b478: 00007f43ef2c5ca0 00007f43ef2b81c8
  00007fff9dd8b488: 00007f43ef2b4248 00007f43ef2b48a8
  00007fff9dd8b498: 00007f43ef2a1618 3f400000ef2b48a8
  00007fff9dd8b4a8: 000055988a5d216f 0000000c00000012
  00007fff9dd8b4b8: 000055988a15789b 00000000ef2b47f0
  00007fff9dd8b4c8: 000055988a5cfeea 00007f43ef2b48a8
  00007fff9dd8b4d8: 00007f43ef2a1618 00007f43ef2b48f8
  00007fff9dd8b4e8: 000055988a5cfe00 000000028b5482f0
  00007fff9dd8b4f8: 00007f43ef2b48f8 00007f43ef2a1618
  00007fff9dd8b508: 00007f43ef2b4248 00007f43ef2a1618
  00007fff9dd8b518: 000055988a2ab7c4 0000559889c36b30
  00007fff9dd8b528: 000055988c1e8c68 00007fff9dd8b538
  00007fff9dd8b538: 00007f43ef2b4848 000055988b24b168
  00007fff9dd8b548: 00007f43ef2b4790 000055988c20ed18
  00007fff9dd8b558: 000055988b420f58 000055988b42ee90
  00007fff9dd8b568: 000055988b2f1de0 000055988b430630
  00007fff9dd8b578: 000055988c20a9c0 00007f43ef2b4248
  00007fff9dd8b588: 00007f43ef2a1618 000000018c2ace10
  00007fff9dd8b598: 000055988a2aafa6 000055988c2acdc0
  00007fff9dd8b5a8: 00007f43ef2b4248 000055988c207290
  00007fff9dd8b5b8: 00007f43ef2b4248 00007f43ef2a1618
  00007fff9dd8b5c8: 000055988a5a352d 000055988b425948
  00007fff9dd8b5d8: 000055988c2ad068 00007f43ef2b4248
  00007fff9dd8b5e8: 000055988c207290 00007f43ef2a1618
  00007fff9dd8b5f8: 000055988a5a69fe 000000018aad3080
  00007fff9dd8b608: 0000559889ac97cd 000055988aad3000
  00007fff9dd8b618: 000055988a5a35f6 000055988b5482f0
  00007fff9dd8b628: 000055988c2acd78 000055988c2ad068
  00007fff9dd8b638: 00000000017d9d78 000055988c207290
  00007fff9dd8b648: 000055988a5a315f 000055988b2673d0
  00007fff9dd8b658: 00007f43ef2a17e8 000055988c214950
  00007fff9dd8b668: 000055988a5aa282 000055988b425948
  00007fff9dd8b678: 000055988c2aecf0 000055988c207290
  00007fff9dd8b688: 00007f43ef2a17e8 000055988c214950
  00007fff9dd8b698: 000055988a5c25b4 000055988b2c1ce8
  00007fff9dd8b6a8: 000055988b2c08c0 000055988c207290
  00007fff9dd8b6b8: 00007f43ef2a1618 000055988c207290
  00007fff9dd8b6c8: 00007f43ef282aa0 000055988c2aecf0
  00007fff9dd8b6d8: 000055988a5c24d2 00007f43ef2ac2d0
  00007fff9dd8b6e8: 000055988c2aea48 000055988b267560
  00007fff9dd8b6f8: 00007f43ef2a17e8 000055988c214910
  00007fff9dd8b708: 000055988a5ab3f1 000055988b425948
  
Stacktrace Stage0:

  Segmentation fault (core dumped)

bartuka 2019-12-29T11:31:19.036300Z

I have no previous experience with java, can you help me understand what is happening?

borkdude 2019-12-29T11:57:23.037Z

@iagwanderson I've tried this before, but I've had no luck with this. There might be a couple of issues mentioning sqlite at the graalvm repo

bartuka 2019-12-29T12:03:31.037400Z

do you know other alternative for database that is current supported?

bartuka 2019-12-29T12:03:56.038Z

my cli is basically a inventory management for my personal books šŸ˜ƒ

bartuka 2019-12-29T12:04:14.038300Z

I need some form of storage

borkdude 2019-12-29T12:04:27.038700Z

@iagwanderson for clj-kondo I just use transit files to store data

borkdude 2019-12-29T12:05:00.039200Z

but you can also shell out to the sqlite cli

borkdude 2019-12-29T12:05:23.039400Z

Here's an example of the latter: https://github.com/borkdude/babashka/blob/master/examples/sqlite.clj

bartuka 2019-12-29T12:07:14.040100Z

oh yes, I like the idea of using shell to do that

bartuka 2019-12-29T12:07:36.040700Z

I'm sorry, I don't know clj-kondo that much, but what kind of data are you storing?

bartuka 2019-12-29T12:07:48.041100Z

in transit files

borkdude 2019-12-29T12:07:49.041300Z

you can even write this in babashka as you can see, no need for intermediate GraalVM compilation and still fast

borkdude 2019-12-29T12:08:09.041600Z

in clj-kondo I'm storing var information like arities

bartuka 2019-12-29T12:09:39.042300Z

I see, I have some relationships within my data. I think babashka and sqlite will save me here o/

bartuka 2019-12-29T12:10:27.043400Z

as I said before, my java experience is very limited, what are the main pain points that make native builds has so many edge cases?

borkdude 2019-12-29T12:11:12.043700Z

it's not a trivial problem to solve I guess

bartuka 2019-12-29T12:12:27.044300Z

I imagine, never had seem a seg fault while working with clojure

bartuka 2019-12-29T12:12:44.044700Z

remembered my fortran jobs in 2012 =P

Kamuela 2019-12-29T14:41:48.044800Z

Iā€™m sorry did you mean 1972? šŸ˜…

bartuka 2019-12-29T14:58:01.045300Z

hahaha I wish! Academic projects are full of this guy still

šŸ˜• 1