-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support GraalVM's native-image #280
Comments
Could you attach your rejection.json config? |
For Caffeine, I'd recommend using a custom |
@graemerocher , my @ben-manes , I thought Caffeine defaults to FJP. Do you mean the way to go is to override to same-thread all over the place? |
Yeah, I'd override per-usage since Caffeine doesn't provide any global singletons, e.g. CacheManager, to orchestrate things. Its more common to use DI rather than statically configure the cache, e.g. to allow overriding the default |
@ben-manes Since |
I have made some changes on the If a solution is possible I will update this ticket. |
Micronaut now works with Graal native image. See https://github.com/graemerocher/micronaut-graal-experiments/tree/master/hello-world-java for an example. |
thanks for creating the example. I follow the steps, but cannot found build/reflect.json? Do I need to install Micronaut before running the example? |
Currently you need Micronaut built from master |
alright. thanks. |
Steps to Reproduce
build
hello-world-kotlin-0.1-all.jar
process it through
native-image
:mx native-image --class-path hello-world-kotlin-0.1-all.jar -H:ReflectionConfigurationFiles=reflection_m.json -H:Name=hw -H:Class=example.Application -H:+ReportUnsupportedElementsAtRuntime
Expected Behaviour
native-image
should be able to compile micronaut app to native image.Current GraalVM/SubstrateVM versions do not support "thread startup" from
static
initializers.Caffeine uses
ForkJoinPool
by default for housekeeping purposes, so the following line breaks native-image generation:micronaut-core/core/src/main/java/io/micronaut/core/convert/ConversionService.java
Line 36 in 48babd7
The thing is
DefaultConversionService
registers default conversions, and it triggersCaffeine
to create a task forForkJoin
, and it causes a thread to start:micronaut-core/core/src/main/java/io/micronaut/core/convert/DefaultConversionService.java
Line 92 in 48babd7
Of course it would be great if SubstrateVM could recognize threads from static initializers, however it does not look like a short-term solution (see oracle/graal#432 )
I think it would be nice if Micronaut could move registration from static initializer to
public static void main
method (or something like that). Is it feasible?Alternative solution could be @ben-manes to create "postpone housekeeping" API, so one could create "thread-free" static-initialized caches.
Just for the reference,
Caffeine
stack looks like follows:Actual Behaviour
Environment Information
Example Application
https://github.com/micronaut-projects/micronaut-examples/tree/master/hello-world-kotlin
The text was updated successfully, but these errors were encountered: