cf-butler icon indicating copy to clipboard operation
cf-butler copied to clipboard

Add GraalVM support

Open pacphi opened this issue 6 years ago • 10 comments

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 avatar Oct 04 '19 18:10 pacphi

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 avatar Dec 16 '19 15:12 pacphi

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 avatar Jan 29 '20 23:01 pacphi

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 avatar Mar 12 '20 14:03 pacphi

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 avatar Mar 12 '20 14:03 pacphi

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

pacphi avatar Apr 09 '20 23:04 pacphi

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 avatar Sep 16 '20 03:09 pacphi

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 avatar May 18 '21 15:05 pacphi

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 avatar Jul 26 '21 15:07 pacphi

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 avatar Oct 16 '23 13:10 pacphi

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)

pacphi avatar Mar 22 '24 15:03 pacphi