Repository navigation
Fix imperative Helidon native image build and startup - #351
Merged
Merged
Conversation
The publish workflow has failed at the Helidon native build since August. GraalVM 25 only allows --static with musl libc, and GraalVM 21's static glibc build fails to link. This applies the workaround a Helidon maintainer recommends in helidon-io/helidon#10767: build a regular dynamically linked binary and run it on oraclelinux:9-slim instead of scratch. The native app also crashed on startup with NoSuchMethodException for RoleAnnotationAnalyzer.init. Since 4.4, Helidon checks by reflection whether an annotation analyzer overrides a deprecated init method, and the native image had no reflection metadata for that lookup. reflect-config.json now registers public methods for both annotation analyzers on the classpath.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Build and Publish Imperative Images workflow has failed on every push to main since August 10, at the Helidon native build. Because Helidon builds first, the Micronaut, Quarkus, and Spring Boot imperative images haven't been published since then either.
Two separate problems were in the way:
--staticunless it uses musl libc. Helidon's own template uses GraalVM 21, where the static glibc build fails to link withundefined reference to `__xmknod'. This is Building Dockerfile.native fails helidon-io/helidon#10767. I applied the second workaround a Helidon maintainer recommends there: drop-Dnative.image.buildStaticand run onoraclelinux:9-sliminstead ofscratch. The first workaround (musl) only works on x86, and the reporter hit runtime errors with it.NoSuchMethodException: RoleAnnotationAnalyzer.init(io.helidon.common.config.Config). Since 4.4, Helidon'sAnnotationAnalyzerusesDeprecationSupport.isOverridden()to check by reflection whether an analyzer overrides a deprecatedinitmethod, and the native image has no reflection metadata for it. The same crash happens with GraalVM 21. A newreflect-config.jsonregisters public methods for both annotation analyzers on the classpath.I built the Docker image locally with
Dockerfile.nativeon arm64. The app started in 23 ms, returned 401 for/hellowithout a token, and returned 200 for/health. The image is 218 MB, up from a static binary onscratch.