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/.
alexmiller 2021-07-01T00:23:52.250800Z

or maybe that's the wrong kind of class to be instrumenting, but same idea wherever

alexmiller 2021-07-01T00:30:38.250900Z

alexmiller 2021-07-01T01:04:07.251200Z

^^ better

borkdude 2021-07-01T09:38:30.251300Z

Thanks, I'm playing around with this now. I'm not entirely sure what this patch is measuring. I changed ms to nanoseconds and also recorded the total nanoseconds. It looks like it doesn't count the static blocks in the __init.class, right?

borkdude 2021-07-01T09:39:12.251600Z

Like here:

borkdude 2021-07-01T09:52:09.252Z

Now added the calls to the static block in the init classes:

borkdude 2021-07-01T10:06:31.252800Z

The total probably isn't correct, I'm counting 18 seconds in total while the entire program takes 4. https://gist.github.com/borkdude/8472055bd5b5e3108b9dbb69debc3137

alexmiller 2021-07-01T13:31:59.253Z

it was counting the static initializer (clinit), which wraps the calls to the initN methods so you shouldn't count both

borkdude 2021-07-01T13:32:37.253200Z

yes, I commented that out

borkdude 2021-07-01T13:32:52.253400Z

you can see the edited patch at the bottom of the gist

Chris Lowe 2021-07-01T16:14:47.260500Z

Hello all Any advice for registering BouncyCastle security providers? I’m attempting to use sshj with HolyLambda. I’m using HL’s `agent/in-context`  mechanism to hit some ssh code which just performs an ls on a target machine. The image builds fine, but I get this at runtime:

Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: Trying to verify a provider that was not registered at build time: BC version 1.68. All providers must be registered and verified in the Native Image builder. 
I’ve seen this https://www.graalvm.org/reference-manual/native-image/JCASecurityServices/ that mentions a param called AdditionalSecurityProviders , but this is reported as not being a valid parameter name: my option:
-H:AdditionalSecurityProviders=org.bouncycastle.jce.provider.BouncyCastleProvider
Error: Could not find option 'AdditionalSecurityProviders'. Use -H:PrintFlags= to list all available options.
Is there anything else I can try?

borkdude 2021-07-01T16:29:09.261Z

@chris.lowe.uk You probably need the dev version for this new parameter.

borkdude 2021-07-01T16:30:11.261800Z

Asking directly in the native image channel on the GraalVM slack may get you better info

borkdude 2021-07-01T16:31:19.262100Z

@chris.lowe.uk > Can you try putting Provider bc = Security.getProvider("BC"); in a class initialized at build time, so it's detected and included automatically.

borkdude 2021-07-01T16:31:35.262400Z

How you can do this in Clojure: just make a top level def with this thing

👍 1
Chris Lowe 2021-07-01T17:14:37.262600Z

@borkdude thank you for the suggestions I added this just below the ns definition:

(java.security.Security/addProvider (BouncyCastleProvider.))

(let [bcProvider (java.security.Security/getProvider "BC")]
  (println "BC" bcProvider)
  (java.security.Security/insertProviderAt bcProvider 1))
And I could see the output from BC during the build:
[output:23]    classlist:   6,816.77 ms,  2.04 GB
[output:23]        (cap):     592.64 ms,  2.04 GB
[output:23]        setup:   2,486.59 ms,  2.04 GB
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See <http://www.slf4j.org/codes.html#StaticLoggerBinder> for further details.
BC #object[org.bouncycastle.jce.provider.BouncyCastleProvider 0x1474f301 BC version 1.68]
[output:23]     (clinit):   1,062.73 ms,  3.59 GB
[output:23]   (typeflow):  32,105.20 ms,  3.59 GB
But still no joy when executing in AWS:
Exception in thread "main" com.oracle.svm.core.jdk.UnsupportedFeatureError: Trying to verify a provider that was not registered at build time: BC version 1.68. All providers must be registered and verified in the Native Image builder. 

borkdude 2021-07-01T17:53:32.262800Z

I think it's better to ask directly in the native image channel on the GraalVM slack

Chris Lowe 2021-07-01T18:05:23.263200Z

Will do. Thank you for the advice