Skip to content
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

Add GraalVM support #103

Open
pacphi opened this issue Oct 4, 2019 · 10 comments
Open

Add GraalVM support #103

pacphi opened this issue Oct 4, 2019 · 10 comments
Labels
feature New feature or request

Comments

@pacphi
Copy link
Collaborator

pacphi commented Oct 4, 2019

Unfortunately, cf-butler makes use of some Java 11 features. Turns out there's an open issue logged here. As soon as this is resolved, and we have a new release of GraalVM, I'll give this a try.

@pacphi
Copy link
Collaborator Author

pacphi commented Dec 16, 2019

Progress

As of 2019-12-16

I used sdkman to install Graal 19.3.0. Then I installed the native-image utility this way:

gu install native-image
Downloading: Component catalog from www.graalvm.org
Processing Component: Native Image
Downloading: Component native-image: Native Image  from github.com
Installing new component: Native Image (org.graalvm.native-image, version 19.3.0)

After building a jar with

gradle build

I attempted to build a native image with:

native-image -jar build/libs/cf-butler-0.1-SNAPSHOT.jar
Build on Server(pid: 18706, port: 61664)*
[cf-butler-0.1-SNAPSHOT:18706]    classlist:   1,853.96 ms
[cf-butler-0.1-SNAPSHOT:18706]        (cap):   2,764.00 ms
[cf-butler-0.1-SNAPSHOT:18706]        setup:   4,008.33 ms
[cf-butler-0.1-SNAPSHOT:18706]     analysis:  16,127.69 ms
Warning: Aborting stand-alone image build due to unsupported features
Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Build on Server(pid: 18706, port: 61664)
[cf-butler-0.1-SNAPSHOT:18706]    classlist:     217.68 ms
[cf-butler-0.1-SNAPSHOT:18706]        (cap):   1,642.21 ms
[cf-butler-0.1-SNAPSHOT:18706]        setup:   2,088.95 ms
[cf-butler-0.1-SNAPSHOT:18706]   (typeflow):   3,798.57 ms
[cf-butler-0.1-SNAPSHOT:18706]    (objects):   3,766.58 ms
[cf-butler-0.1-SNAPSHOT:18706]   (features):     139.58 ms
[cf-butler-0.1-SNAPSHOT:18706]     analysis:   7,861.51 ms
[cf-butler-0.1-SNAPSHOT:18706]     (clinit):     205.27 ms
[cf-butler-0.1-SNAPSHOT:18706]     universe:     736.80 ms
[cf-butler-0.1-SNAPSHOT:18706]      (parse):     942.45 ms
[cf-butler-0.1-SNAPSHOT:18706]     (inline):   2,722.06 ms
[cf-butler-0.1-SNAPSHOT:18706]    (compile):   9,726.40 ms
[cf-butler-0.1-SNAPSHOT:18706]      compile:  14,002.06 ms
[cf-butler-0.1-SNAPSHOT:18706]        image:   1,355.94 ms
[cf-butler-0.1-SNAPSHOT:18706]        write:     407.33 ms
[cf-butler-0.1-SNAPSHOT:18706]      [total]:  26,785.47 ms
Warning: Image 'cf-butler-0.1-SNAPSHOT' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation).

Result

  • We still need to use the JDK for execution
  • Native image size is approximately 1/10 the size of the jar
  • Startup time is reduced by 1/2

Action Items

  • Remove constraint on JDK
  • Employ the binary buildpack and cf push the native image
  • Diagnose, troubleshoot and fix any issues consuming environment variables and/or binding service instances

@pacphi
Copy link
Collaborator Author

pacphi commented Jan 29, 2020

With the recent release of Graal 19.3.1 I decided to give the native image build another try but was sorely disappointed

native-image -jar build/libs/cf-butler-0.1-SNAPSHOT.jar -H:+ReportExceptionStackTraces --no-fallback

yielded

Build on Server(pid: 68600, port: 63005)
[cf-butler-0.1-SNAPSHOT:68600]    classlist:     294.22 ms
[cf-butler-0.1-SNAPSHOT:68600]        (cap):   1,171.93 ms
[cf-butler-0.1-SNAPSHOT:68600]        setup:   1,495.84 ms
[cf-butler-0.1-SNAPSHOT:68600]   (typeflow):   4,859.79 ms
[cf-butler-0.1-SNAPSHOT:68600]    (objects):   5,149.75 ms
[cf-butler-0.1-SNAPSHOT:68600]   (features):     209.16 ms
[cf-butler-0.1-SNAPSHOT:68600]     analysis:  10,475.93 ms
Error: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported field java.net.URL.handlers is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing java.net.URL.setURLStreamHandlerFactory(URL.java:1212)
Call path from entry point to java.net.URL.setURLStreamHandlerFactory(URLStreamHandlerFactory): 
        at java.net.URL.setURLStreamHandlerFactory(URL.java:1204)
        at org.springframework.boot.loader.jar.JarFile.resetCachedUrlHandlers(JarFile.java:408)
        at org.springframework.boot.loader.jar.JarFile.registerUrlProtocolHandler(JarFile.java:398)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.registerAsParallelCapable() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing org.springframework.boot.loader.LaunchedURLClassLoader.<clinit>(LaunchedURLClassLoader.java:42)
Call path from entry point to org.springframework.boot.loader.LaunchedURLClassLoader.<clinit>(): 
        no path found from entry point to target method


com.oracle.svm.core.util.UserError$UserException: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported field java.net.URL.handlers is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing java.net.URL.setURLStreamHandlerFactory(URL.java:1212)
Call path from entry point to java.net.URL.setURLStreamHandlerFactory(URLStreamHandlerFactory): 
        at java.net.URL.setURLStreamHandlerFactory(URL.java:1204)
        at org.springframework.boot.loader.jar.JarFile.resetCachedUrlHandlers(JarFile.java:408)
        at org.springframework.boot.loader.jar.JarFile.registerUrlProtocolHandler(JarFile.java:398)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.registerAsParallelCapable() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing org.springframework.boot.loader.LaunchedURLClassLoader.<clinit>(LaunchedURLClassLoader.java:42)
Call path from entry point to org.springframework.boot.loader.LaunchedURLClassLoader.<clinit>(): 
        no path found from entry point to target method


        at com.oracle.svm.core.util.UserError.abort(UserError.java:75)
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:221)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:736)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 2 methods
Detailed message:
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported field java.net.URL.handlers is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing java.net.URL.setURLStreamHandlerFactory(URL.java:1212)
Call path from entry point to java.net.URL.setURLStreamHandlerFactory(URLStreamHandlerFactory): 
        at java.net.URL.setURLStreamHandlerFactory(URL.java:1204)
        at org.springframework.boot.loader.jar.JarFile.resetCachedUrlHandlers(JarFile.java:408)
        at org.springframework.boot.loader.jar.JarFile.registerUrlProtocolHandler(JarFile.java:398)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:49)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52)
        at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
        at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
        at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.registerAsParallelCapable() is reachable: The declaring class of this element has been substituted, but this element is not present in the substitution class
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing org.springframework.boot.loader.LaunchedURLClassLoader.<clinit>(LaunchedURLClassLoader.java:42)
Call path from entry point to org.springframework.boot.loader.LaunchedURLClassLoader.<clinit>(): 
        no path found from entry point to target method


        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:733)
        ... 8 more
Error: Image build request failed with exit status 1

Need to dig into this a bit more.

@pacphi
Copy link
Collaborator Author

pacphi commented Mar 12, 2020

As of 2020-03-12

Still seeing the same exception as noted earlier with native-image builds using Graal VM version 20.0.0.r11-grl.

@pacphi
Copy link
Collaborator Author

pacphi commented Mar 12, 2020

So there's this project, spring-graal-native and this guidance.

tl;dr Have fire up the app with java and the agent, exercise code paths, then use the configuration data when building the native image. Not 100% guarantee this'll work though.

Will report back later.

@pacphi
Copy link
Collaborator Author

pacphi commented Apr 9, 2020

An updated release of Spring Graal Native is available, but perhaps a bit too involved to confidently generate a functioning native-image.

@pacphi
Copy link
Collaborator Author

pacphi commented Sep 16, 2020

Getting close now. The codebase has been brought forward to Spring Boot 2.4.0.M2. So we'll be in position to produce native images using the Maven plugin.

Unfortunately, it appears we're hung up on JGit support in GraalVM, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=546175. And it even looks like there's an outstanding PR that potentially addresses it, here: https://github.com/eclipse/jgit/pull/65.

@pacphi
Copy link
Collaborator Author

pacphi commented May 18, 2021

So, latest testing with Spring Boot 2.4.5 and Spring Native 0.9.2 yielded exceptions (see below). Seems to point to an issue w/ Log4J2 and LMAX Disruptor dependencies now. I chose that combo for logging purposes early on because Logback drops messages.

[creator]     [/layers/paketo-buildpacks_native-image/native-image/io.pivotal.cfapp.AppInit:195]     analysis:  14,664.27 ms,  4.70 GB
[INFO]     [creator]     Error: Classes that should be initialized at run time got initialized during image building:
[INFO]     [creator]      com.lmax.disruptor.MultiProducerSequencer was unintentionally initialized at build time. To see why com.lmax.disruptor.MultiProducerSequencer got initialized use --trace-class-initialization=com.lmax.disruptor.MultiProducerSequencer
[INFO]     [creator]     com.sun.jmx.defaults.JmxProperties was unintentionally initialized at build time. To see why com.sun.jmx.defaults.JmxProperties got initialized use --trace-class-initialization=com.sun.jmx.defaults.JmxProperties
[INFO]     [creator]     com.lmax.disruptor.Sequence was unintentionally initialized at build time. To see why com.lmax.disruptor.Sequence got initialized use --trace-class-initialization=com.lmax.disruptor.Sequence
[INFO]     [creator]     com.lmax.disruptor.util.Util was unintentionally initialized at build time. To see why com.lmax.disruptor.util.Util got initialized use --trace-class-initialization=com.lmax.disruptor.util.Util
[INFO]     [creator]     com.sun.jmx.mbeanserver.MBeanInstantiator was unintentionally initialized at build time. To see why com.sun.jmx.mbeanserver.MBeanInstantiator got initialized use --trace-class-initialization=com.sun.jmx.mbeanserver.MBeanInstantiator
[INFO]     [creator]     com.oracle.truffle.js.scriptengine.GraalJSEngineFactory was unintentionally initialized at build time. To see why com.oracle.truffle.js.scriptengine.GraalJSEngineFactory got initialized use --trace-class-initialization=com.oracle.truffle.js.scriptengine.GraalJSEngineFactory
[INFO]     [creator]     com.sun.jmx.mbeanserver.Introspector was unintentionally initialized at build time. To see why com.sun.jmx.mbeanserver.Introspector got initialized use --trace-class-initialization=com.sun.jmx.mbeanserver.Introspector
[INFO]     [creator]     com.lmax.disruptor.RingBuffer was unintentionally initialized at build time. To see why com.lmax.disruptor.RingBuffer got initialized use --trace-class-initialization=com.lmax.disruptor.RingBuffer
[INFO]     [creator]     com.lmax.disruptor.RingBufferFields was unintentionally initialized at build time. To see why com.lmax.disruptor.RingBufferFields got initialized use --trace-class-initialization=com.lmax.disruptor.RingBufferFields
[INFO]     [creator]     com.lmax.disruptor.TimeoutException was unintentionally initialized at build time. To see why com.lmax.disruptor.TimeoutException got initialized use --trace-class-initialization=com.lmax.disruptor.TimeoutException
[INFO]     [creator]     jdk.management.jfr.SettingDescriptorInfo was unintentionally initialized at build time. To see why jdk.management.jfr.SettingDescriptorInfo got initialized use --trace-class-initialization=jdk.management.jfr.SettingDescriptorInfo

@pacphi
Copy link
Collaborator Author

pacphi commented Jul 26, 2021

Some great progress by the Spring engineering team on features and fixes within spring-native. Latest trial here, allows for successful build of container image with

mvn --batch-mode -Pnative clean spring-boot:build-image

but when we attempt to run with

docker run -p:8080:8080 -it --rm -e PIVNET_API-TOKEN=xxx -e CF_TOKEN-PROVIDER=sso -e CF_API-HOST=api.run.pcfone.io -e CF_REFRESH-TOKEN=xxx -e LOGGING_LEVEL_ORG_SPRINGFRAMEWORK_DATA_CONVERT=DEBUG cf-butler:1.0-SNAPSHOT

we see

2021-07-26 15:00:00.001  INFO 1 --- [   scheduling-1] io.pivotal.cfapp.task.TkTask             : TkTask started
2021-07-26 15:00:00.012  INFO 1 --- [TaskExecutor-97] io.pivotal.cfapp.task.UsageTask          : UsageTask started
2021-07-26 15:00:00.012  INFO 1 --- [TaskExecutor-98] io.pivotal.cfapp.task.BuildpacksTask     : BuildpacksTask started
2021-07-26 15:00:00.012  INFO 1 --- [   scheduling-1] io.pivotal.cfapp.task.TkTask             : TkTask completed
2021-07-26 15:00:00.012  INFO 1 --- [TaskExecutor-99] io.pivotal.cfapp.task.OrganizationsTask  : OrganizationTask started
2021-07-26 15:00:00.012  INFO 1 --- [askExecutor-100] io.pivotal.cfapp.task.StacksTask         : StacksTask started
2021-07-26 15:00:01.007  INFO 1 --- [tor-http-nio-12] io.pivotal.cfapp.task.OrganizationsTask  : OrganizationTask completed
2021-07-26 15:00:01.007  INFO 1 --- [askExecutor-104] io.pivotal.cfapp.task.SpacesTask         : SpacesTask started
2021-07-26 15:00:01.025  INFO 1 --- [tor-http-nio-12] io.pivotal.cfapp.task.StacksTask         : StacksTask completed
2021-07-26 15:00:01.228  INFO 1 --- [tor-http-nio-12] io.pivotal.cfapp.task.BuildpacksTask     : BuildpacksTask completed
2021-07-26 15:00:01.256  INFO 1 --- [ctor-http-nio-1] io.pivotal.cfapp.task.SpacesTask         : SpacesTask completed
2021-07-26 15:00:01.256  INFO 1 --- [askExecutor-114] io.pivotal.cfapp.task.SpaceUsersTask     : SpaceUsersTask started
2021-07-26 15:00:01.256  INFO 1 --- [askExecutor-115] i.p.c.task.ServiceInstanceDetailTask     : ServiceInstanceDetailTask started
2021-07-26 15:00:01.256  INFO 1 --- [askExecutor-120] io.pivotal.cfapp.task.AppDetailTask      : AppDetailTask started
2021-07-26 15:00:01.585 ERROR 1 --- [ctor-http-nio-2] io.pivotal.cfapp.task.AppDetailTask      : AppDetailTask terminated with error

java.lang.IndexOutOfBoundsException: Source emitted more than one item
        at reactor.core.publisher.MonoSingle$SingleSubscriber.onNext(MonoSingle.java:134) ~[na:na]
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoSingle] :
        reactor.core.publisher.Flux.single(Flux.java:7925)
        org.cloudfoundry.operations._DefaultCloudFoundryOperations.getSpace(_DefaultCloudFoundryOperations.java:287)
Error has been observed at the following site(s):
        |_        Flux.single ? at org.cloudfoundry.operations._DefaultCloudFoundryOperations.getSpace(_DefaultCloudFoundryOperations.java:287)
        |_ Mono.onErrorResume ? at org.cloudfoundry.operations._DefaultCloudFoundryOperations.getSpace(_DefaultCloudFoundryOperations.java:288)
        |_       Mono.flatMap ? at org.cloudfoundry.operations._DefaultCloudFoundryOperations.getSpaceId(_DefaultCloudFoundryOperations.java:249)
        |_           Mono.map ? at org.cloudfoundry.operations._DefaultCloudFoundryOperations.getSpaceId(_DefaultCloudFoundryOperations.java:250)
        |_         Mono.cache ? at java.util.Optional.orElseGet(Optional.java:369)
        |_           Mono.zip ? at org.cloudfoundry.operations.applications.DefaultApplications.list(DefaultApplications.java:331)
        |_       Mono.flatMap ? at org.cloudfoundry.operations.applications.DefaultApplications.list(DefaultApplications.java:332)
        |_   Mono.flatMapMany ? at org.cloudfoundry.operations.applications.DefaultApplications.list(DefaultApplications.java:333)
        |_           Flux.map ? at org.cloudfoundry.operations.applications.DefaultApplications.list(DefaultApplications.java:334)
        |_     Flux.transform ? at org.cloudfoundry.operations.applications.DefaultApplications.list(DefaultApplications.java:335)
        |_    Flux.checkpoint ? at org.cloudfoundry.operations.applications.DefaultApplications.list(DefaultApplications.java:336)
        |_ Flux.delayElements ? at io.pivotal.cfapp.task.AppDetailTask.listApplications(AppDetailTask.java:297)
        |_       Flux.flatMap ? at io.pivotal.cfapp.task.AppDetailTask.listApplications(AppDetailTask.java:298)
        |_     Flux.concatMap ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:155)
        |_       Flux.flatMap ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:156)
        |_       Flux.flatMap ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:157)
        |_       Flux.flatMap ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:158)
        |_       Flux.flatMap ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:159)
        |_      Flux.thenMany ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:160)
        |_      Flux.thenMany ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:160)
        |_   Flux.collectList ? at io.pivotal.cfapp.task.AppDetailTask.collect(AppDetailTask.java:161)
Stack trace:
                at reactor.core.publisher.MonoSingle$SingleSubscriber.onNext(MonoSingle.java:134) ~[na:na]
                at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:712) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:588) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:955) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:164) ~[na:na]
                at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86) ~[na:na]
                at reactor.core.publisher.Flux.subscribe(Flux.java:8402) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:250) ~[na:na]
                at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.drainAsync(FluxFlattenIterable.java:421) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.drain(FluxFlattenIterable.java:686) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlattenIterable$FlattenIterableSubscriber.onNext(FluxFlattenIterable.java:250) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxBuffer$BufferExactSubscriber.onComplete(FluxBuffer.java:185) ~[na:na]
                at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.java:193) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.java:81) ~[na:na]
                at reactor.core.publisher.Flux.subscribe(Flux.java:8402) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.MonoFlatMapMany$FlatMapManyMain.onNext(MonoFlatMapMany.java:195) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.Operators$MonoInnerProducerBase.complete(Operators.java:2664) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.MonoSingle$SingleSubscriber.onComplete(MonoSingle.java:180) ~[na:na]
                at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:846) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlatMap$FlatMapMain.innerComplete(FluxFlatMap.java:894) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxFlatMap$FlatMapInner.onComplete(FluxFlatMap.java:997) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:150) ~[na:na]
                at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onComplete(FluxHandleFuseable.java:229) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onComplete(FluxMapFuseable.java:344) ~[na:na]
                at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onComplete(FluxDoFinally.java:145) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onComplete(FluxHandleFuseable.java:229) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onComplete(FluxContextWrite.java:126) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1817) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.MonoCollectList$MonoCollectListSubscriber.onComplete(MonoCollectList.java:128) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onComplete(FluxPeekFuseable.java:277) ~[na:na]
                at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:150) ~[na:na]
                at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onComplete(FluxDoFinally.java:145) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142) ~[io.pivotal.cfapp.AppInit:3.4.8]
                at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:400) ~[io.pivotal.cfapp.AppInit:1.0.9]
                at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:419) ~[io.pivotal.cfapp.AppInit:1.0.9]
                at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:473) ~[io.pivotal.cfapp.AppInit:1.0.9]
                at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:684) ~[io.pivotal.cfapp.AppInit:1.0.9]
                at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93) ~[io.pivotal.cfapp.AppInit:1.0.9]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1374) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1237) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1286) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:507) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:446) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[na:na]
                at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) ~[na:na]
                at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) ~[na:na]
                at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) ~[na:na]
                at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[na:na]
                at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[io.pivotal.cfapp.AppInit:4.1.66.Final]
                at java.lang.Thread.run(Thread.java:829) ~[io.pivotal.cfapp.AppInit:na]
                at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553) ~[na:na]
                at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192) ~[na:na]

It wasn't immediately evident what was the matter above, until I scoured the issues backlog and saw that there is no support for EventListeners yet.

Hopefully we'll see support soon in the spring-native 0.11.x release branch.

Current effort can be tracked in native-hints-scan-feature branch.

@pacphi pacphi added the feature New feature or request label Aug 5, 2021
@pacphi
Copy link
Collaborator Author

pacphi commented Oct 16, 2023

While we have Graal native image compilation plumbed, the images produced lack certain resources at runtime. We have some variability at build time in terms of which src/main/resources subfolders file contents we'd include based on activated Maven profiles (for db provider).

This article looks useful: https://www.graalvm.org/latest/reference-manual/native-image/guides/include-resources/.

@pacphi
Copy link
Collaborator Author

pacphi commented Mar 22, 2024

Recently adjusted config for maven-native-plugin in pom.xml. But still getting these startup exceptions:

Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: NULL not allowed for column "COLLECTION_TIME"; SQL statement:
INSERT INTO time_keeper VALUES (DEFAULT) [23502-224]
        at org.h2.table.Column.validateConvertUpdateSequence(Column.java:365)
        at org.h2.table.Table.convertInsertRow(Table.java:936)
        at org.h2.command.dml.Insert.insertRows(Insert.java:167)
        at org.h2.command.dml.Insert.update(Insert.java:135)
        at org.h2.command.CommandContainer.executeUpdateWithGeneratedKeys(CommandContainer.java:242)
        at org.h2.command.CommandContainer.update(CommandContainer.java:163)
        at org.h2.command.Command.executeUpdate(Command.java:256)
        at io.r2dbc.h2.client.SessionClient.update(SessionClient.java:144)
        at io.r2dbc.h2.H2Statement.lambda$execute$2(H2Statement.java:150)
        ... 354 common frames omitted
07:53:36.218 [cloudfoundry-client-epoll-2] ERROR cloudfoundry-client.compatibility - An error occurred while checking version compatibility:
org.cloudfoundry.reactor.util.JsonParsingException: Cannot construct instance of `org.cloudfoundry.client.v2.info.GetInfoResponse`: cannot deserialize from Object value (no delegate- or property-based Creator): this appears to be a native image, in which case you may need to configure reflection for the class that is to be deserialized
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]
        at org.cloudfoundry.reactor.util.JsonCodec.lambda$decode$0(JsonCodec.java:52)
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoMapFuseable] :
        reactor.core.publisher.Mono.map(Mono.java:3478)
        org.cloudfoundry.reactor.util.JsonCodec.decode(JsonCodec.java:44)
Error has been observed at the following site(s):
        *____________Mono.map ⇢ at org.cloudfoundry.reactor.util.JsonCodec.decode(JsonCodec.java:44)
        *________Flux.flatMap ⇢ at org.cloudfoundry.reactor.util.Operator$ResponseReceiver.parseBodyToFlux(Operator.java:251)
        |_ Flux.singleOrEmpty ⇢ at org.cloudfoundry.reactor.util.Operator$ResponseReceiver.parseBodyToMono(Operator.java:256)
        *________Mono.flatMap ⇢ at org.cloudfoundry.reactor.client.v2.AbstractClientV2Operations.get(AbstractClientV2Operations.java:97)
        |_       checkpoint() ⇢ at org.cloudfoundry.reactor.client.v2.info.ReactorInfo.get(ReactorInfo.java:52)
        |_           Mono.map ⇢ at org.cloudfoundry.reactor.client.CloudFoundryClientCompatibilityChecker.check(CloudFoundryClientCompatibilityChecker.java:42)
        *________Mono.zipWith ⇢ at org.cloudfoundry.reactor.client.CloudFoundryClientCompatibilityChecker.check(CloudFoundryClientCompatibilityChecker.java:43)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant