holy-lambda

steveb8n 2022-05-09T07:31:36.874839Z

Q: I just updated to the latest HL. I migrated all the :envs out and was happy to see much less mem required for native executable. but now my native lambdas fail with this error: Caused by: java.io.FileNotFoundException: Could not locate clojure/core/server__init.class, clojure/core/server.clj or clojure/core/server.cljc on classpath Has anyone seen this before?

steveb8n 2022-05-09T07:38:19.914519Z

I’ve tried a fresh HL project. it creates a native executable ok but the sam local invoke fails. not sure why. that means I can’t compare with a working sample to find the issue

steveb8n 2022-05-09T07:52:32.292879Z

I have no clj code that requires or invokes “server” so I’m a bit confused

steveb8n 2022-05-09T08:49:37.982429Z

ah, I didn’t have the clj-easy dep included. working my way through that now

Karol Wójcik 2022-05-09T08:54:14.343689Z

:D

Karol Wójcik 2022-05-09T08:54:35.454139Z

Yeah. Exactly! clj-easy is what you need ;>

steveb8n 2022-05-09T08:55:08.123759Z

thanks. just learning how to do the init at runtime thing now with this new setup

❤️ 1
Karol Wójcik 2022-05-09T08:56:34.784739Z

Cool. I hope you’re already using ARM ;)

steveb8n 2022-05-09T08:57:12.868469Z

no, still on intel. I don’t need the extra speed

steveb8n 2022-05-09T08:57:28.883479Z

might switch when I get more load in future

steveb8n 2022-05-09T09:41:19.142429Z

Q: I have some AWS api v2 classes that need to be runtime init. I have add the graal flag but do I also need to move them out of the namespace import form and import them at runtime when they are used in fns now? @karol.wojcik

steveb8n 2022-05-09T09:41:41.476689Z

at the moment the ns import is causing them to init at build time

steveb8n 2022-05-09T09:42:15.338189Z

I’m not sure how to do a runtime import in clj

steveb8n 2022-05-09T09:45:38.701519Z

I suspect I need to use hl:native:conf for this, like in v0.5.0

Karol Wójcik 2022-05-09T09:46:49.760769Z

You can set this class as init-at-build-time.

steveb8n 2022-05-09T09:47:21.009109Z

ok. isn’t that done automatically by clj-easy?

Karol Wójcik 2022-05-09T09:47:32.737419Z

Nope.

Karol Wójcik 2022-05-09T09:47:58.778209Z

clj-easy is for adding Clojure namespaces to build-time.

steveb8n 2022-05-09T09:48:19.687599Z

ok. I’ll try that. so 0.6.0 should not require the use of hl:native:conf at all now?

steveb8n 2022-05-09T09:48:41.572669Z

the docs seem to imply that it’s still useful so I’m not sure

Karol Wójcik 2022-05-09T09:48:42.917049Z

Why you thing configuration is not necessary?

Karol Wójcik 2022-05-09T09:48:57.517659Z

It's still necessary to run this step.

steveb8n 2022-05-09T09:49:06.587839Z

ok good to know

steveb8n 2022-05-09T09:49:38.852369Z

the reason I though it was not required was because of the sample project. in there, conf is not invoked

steveb8n 2022-05-09T09:50:11.313259Z

but this is good. I am familiar will conf so I’ll start using it tomorrow. stopping for the night now

steveb8n 2022-05-09T09:50:15.651329Z

thanks for the pointers

Karol Wójcik 2022-05-09T09:50:26.226009Z

This is because HL now ships with the default configuration for it's internal namespaces.

Karol Wójcik 2022-05-09T09:51:03.117399Z

But other namespaces/java classes may still require generating configuration.

steveb8n 2022-05-10T03:16:22.083159Z

Hi @karol.wojcik I’m still having trouble making this work in CI. I can make it work on M1 and Intel locally but not on CI where I need it most. I suspect that it’s a versioning problem. The local good builds use jdk11 for conf and executable but, in CI, it uses jdk8 for the executable step

steveb8n 2022-05-10T03:16:24.089879Z

+ bb hl:native:executable [holy-lambda] Executable /root/.graalvm/bin/java does not exists! Using fallback: java instead! Did you set up GRAALVM_HOME? [holy-lambda] Executable /root/.graalvm/bin/native-image does not exists! Using fallback: native-image instead! Did you set up GRAALVM_HOME? [holy-lambda] Command <hl:native:executable> Executing [ /opt/graalvm-ce-java8-21.2.0/jre/bin/java \ -XX:+UseParallelGC \ -XX:+UnlockExperimentalVMOptions \ -XX:+EnableJVMCI \

steveb8n 2022-05-10T03:17:23.169629Z

this is my best guess at why it’s failing there. my CI build uses fierycod/graalvm-native-image:ce as its base image. could this be the reason?

steveb8n 2022-05-10T03:35:35.269639Z

ok. just as I typed this, I got it to compile. not sure how I found the magic combination. was not very scientific

steveb8n 2022-05-10T03:35:54.968479Z

any suggestions about that native:executable version?

steveb8n 2022-05-10T03:36:21.117709Z

also: since I’m using an HL docker image, could/should I use HL_NO_DOCKER?

Karol Wójcik 2022-05-10T04:21:43.732299Z

To a last question: YES. Regarding image. The CE is deprecated builder. You can find most recent builders images here https://github.com/FieryCod/holy-lambda/pkgs/container/holy-lambda-builder

steveb8n 2022-05-10T04:31:55.831109Z

thanks. I tried one of those images but it didn’t have the “clojure” cli in it. I guess I need to look closer

steveb8n 2022-05-10T04:32:04.731639Z

and I’ll try no docker as well

steveb8n 2022-05-10T04:41:18.186399Z

would you consider adding the “clojure” cli to those images so I can run tests using the same image? I can create my own image based on those but it’s simpler if I just have 1

steveb8n 2022-05-10T05:21:58.224929Z

maybe that’s not possible due to EE license constraints?

steveb8n 2022-05-10T05:22:12.125149Z

I’m creating my own image from yours

Karol Wójcik 2022-05-10T05:50:56.298479Z

Nah. I dont want to add Clojure to an image. In future I will probably add two variant of images. One extra slim based on alpine and without polyglot capabilities, and one with. For CI you should treat the builder images as a base.

steveb8n 2022-05-10T06:12:29.692269Z

fair enough. I can confirm that with a CI docker image derived from your stable release, the versions now match for “conf” and “executable”. one less variable to worry about

steveb8n 2022-05-10T06:16:27.678349Z

and a lot less memory consumed. so much better. thanks

Karol Wójcik 2022-05-10T06:16:46.041709Z

:>

Karol Wójcik 2022-05-10T06:16:55.449579Z

Very happy to hear it!

Volodymyr Vizovskyy 2022-05-09T17:01:01.900919Z

Hi! I just followed https://github.com/FieryCod/holy-lambda/tree/master/examples/bb/native/cognitect.aws.api guide to set up an AWS client in my lambda. However, when I try to bb hl:native:executablethis is what I see:

Error: Unsupported features in 4 methods
Detailed message:
Error: Detected a started Thread in the image heap. Threads running in the image generator are no longer running at image runtime.  To see how this object got instantiated use --trace-object-instantiation=java.lang.Thread. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by
	reading field clojure.lang.Delay.val of
		constant clojure.lang.Delay@a7c489a reached by
	reading field clojure.lang.Var.root of
		constant clojure.lang.Var@296a969a reached by
	scanning method clojure.core.async.impl.timers$timeout.invokeStatic(timers.clj:58)
Call path from entry point to clojure.core.async.impl.timers$timeout.invokeStatic(long):
	at clojure.core.async.impl.timers$timeout.invokeStatic(timers.clj:58)
	at clojure.core.async$timeout.invokeStatic(async.clj:109)
	at clojure.core.proxy$clojure.lang.APersistentMap$ff19274a.iterator(Unknown Source)
	at clojure.lang.RT.seqFrom(RT.java:547)
	at clojure.lang.RT.seq(RT.java:537)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS_core_main_ac790e17c7c5fc73439035595d460119bb4bd9a0(generated:0)
Has anybody ever had anything similar?

Karol Wójcik 2022-05-10T08:16:04.886929Z

I will check this.

Volodymyr Vizovskyy 2022-06-07T21:48:25.561559Z

Yes, by rewriting almost everything from the first principles 😅 it turned out that what slipped my eyes was this bad boy: https://github.com/brunoV/throttler which is, according to its own README, Based on core.async - not a known friend of GraalVM.

Karol Wójcik 2022-06-08T06:46:28.677719Z

Oh cool! Yes. Unfortunately the core.async is not an easy beast to integrate with GraalVM.

Karol Wójcik 2022-06-08T06:46:37.923449Z

Cool you have figured it out!

🙌 1
Karol Wójcik 2022-06-07T05:45:27.817259Z

@volodymyr085 was you able to get rid of the issue?

Volodymyr Vizovskyy 2022-05-09T17:01:30.534249Z

full trace here btw. It's HUGE