Closed josh-7t closed 2 years ago
Any questions? concerns?
Hi Joshua, you might get faster responses if you add me as a reviewer. Erik (slipset) is the overall clj-commons maintainer, but doesn't really review aleph/manifold/etc code.
I bumped up the byte-streams version, so you don't need to do that in this PR.
As for the rest, I need to take a deeper look. Unfortunately, I don't know much about Graal. However, I can say this is a breaking change for anyone who currently uses the pool and executor outside of Aleph.
When it says:
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=
. Or you can write your own initialization methods and call them explicitly from your main entry point."
does that mean you could bypass the issue by using --initialize-at-run-time=java.lang.Thread
or something similar?
I just did a simple HTTP server using Aleph and Graal native-image without any issues (expect the usual ones - plus the Netty ones).
Here is the dummy project: https://github.com/arnaudgeiser/aleph-graal
And the native-image flags I'm using:
:opts ["--no-fallback"
"--report-unsupported-elements-at-runtime"
"--initialize-at-build-time"
"--allow-incomplete-classpath"
"--initialize-at-run-time=io.netty.channel.DefaultFileRegion"
"--initialize-at-run-time=io.netty.channel.epoll.Epoll"
"--initialize-at-run-time=io.netty.channel.epoll.Native"
"--initialize-at-run-time=io.netty.channel.epoll.EpollEventLoop"
"--initialize-at-run-time=io.netty.channel.epoll.EpollEventArray"
"--initialize-at-run-time=io.netty.channel.unix.Errors"]}
As it's working on me side, the PR is one year old and we have no news from the requester, I will close.
Do not hesitate to re-open another one @josh-7t if needed.
Graal does not like it when
Thread
objects are initialized at build time (statically) e.g. error:Wrapping the statically defined
connection-pool
s andexecutor
s withdelay
ensures that the threads are not started until runtime.Also upgrading
netty
resolves this object initialization error when compiling with graal:And finally when https://github.com/clj-commons/byte-streams/pull/50 gets merged I would like to include up-versioning
byte-streams
in this pr.