spring-native icon indicating copy to clipboard operation
spring-native copied to clipboard

RabbitMQ Regression with GraalVM 22.1

Open goafabric opened this issue 2 years ago • 4 comments

While the implicit upgrade of paketo to GraalVM 22.1 fixed things for JPA. It on the other hand broke RabbitMQ Hints

While this branch worked flawlessly 2 months ago (it bootstraps the application during build to verify that application start works) https://github.com/goafabric/event-dispatcher-service/actions/runs/2225017519

A direct copy now breaks: https://github.com/goafabric/event-dispatcher-service/actions/runs/2507912855

See error below -- the @Queuebinding inside LoggerAdapter brakes. Upgrading or downgrading spring (native) wont change anything The only difference i can spot is graalvm 22.0.1 vs 22.1

I guess the Class LoggerAdapter alone should be enough to cause the behaviour

-- cut --- com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.springframework.amqp.rabbit.annotation.QueueBinding, interface org.springframework.core.annotation.SynthesizedAnnotation] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles= and -H:DynamicProxyConfigurationResources= options. 1187 2022-06-16 09:09:19.706 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed 1188 1189 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loggerAdapter': Initialization of bean failed; nested exception is com.oracle.svm.core.jdk.UnsupportedFeatureError: Proxy class defined by interfaces [interface org.springframework.amqp.rabbit.annotation.QueueBinding, interface org.springframework.core.annotation.SynthesizedAnnotation] not found. Generating proxy classes at runtime is not supported. Proxy classes need to be defined at image build time by specifying the list of interfaces that they implement. To define proxy classes use -H:DynamicProxyConfigurationFiles= and -H:DynamicProxyConfigurationResources= options.

goafabric avatar Jun 16 '22 09:06 goafabric

Honestly .. I would also expect that the graalvm version / paketo build is tied to the spring-native version. I know that this can be configured manually .. but neither was i able to understand the versioning scheme.

And I think this should be the default behaviour .. otherwise builds are never repeatable .. and thats a huge bummer.

The next Milestone also has a already fixed issue due to GraalVM behaviour change: https://github.com/spring-projects-experimental/spring-native/issues/1584

goafabric avatar Jun 16 '22 10:06 goafabric

I understand the pain of non repeatable builds with Buildpacks and the fact that the versioning scheme is not easy to understand. I will raise that point to Spring Boot team for Spring Boot 3.

sdeleuze avatar Jun 16 '22 14:06 sdeleuze

@sdeleuze thank you

goafabric avatar Jun 17 '22 05:06 goafabric

just to add .. its actually the same graalvm 22.1 version here .. just the build packs internal version differ 5.2.1 vs 5.2.3 however i was not able to figure out which parameter that will be .. very confusing configured to the latest one documented here https://paketo.io//docs/howto/java/#configure-the-graalvm-version => gcr.io/paketo-buildpacks/java-native-image:5.12.0 => this falls back to graalvm 21.3 and than works

goafabric avatar Jun 17 '22 13:06 goafabric

With Spring Boot 3.0 M5 it works nearly out of the Box. Just a hint for RabbitHealthIndicator is missing

`static class ApplicationRuntimeHints implements RuntimeHintsRegistrar {

    @Override
    public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
        registerReflection(RabbitHealthIndicator.class, hints);
    }

    private void registerReflection(Class clazz, RuntimeHints hints) {
        Arrays.stream(clazz.getDeclaredConstructors()).forEach(
                r -> hints.reflection().registerConstructor(r, ExecutableMode.INVOKE));
        Arrays.stream(clazz.getDeclaredMethods()).forEach(
                r -> hints.reflection().registerMethod(r, ExecutableMode.INVOKE));
    }

}`

goafabric avatar Oct 14 '22 08:10 goafabric

Thanks, @goafabric. I think we've fixed that for RC1: https://github.com/spring-projects/spring-boot/issues/32541.

wilkinsona avatar Oct 14 '22 09:10 wilkinsona

@wilkinsona cool thank you

goafabric avatar Oct 14 '22 10:10 goafabric