paketo-buildpacks / spring-boot

A Cloud Native Buildpack that contributes Spring Boot dependency information and slices an application into multiple layers
Apache License 2.0
170 stars 22 forks source link

Intermittent issue with CDS: [warning][cds] Dynamic archive cannot be used: static archive header checksum verification failed. #481

Closed anthonydahanne closed 4 months ago

anthonydahanne commented 4 months ago

If trying to apply CDS training run via spring-boot buildpack latest version, via pack (providing source code), it's possible the buildpack mixes up JDK and JRE during training run (using the JDK during the training run instead of the JRE that will be used for runtime)

Expected Behavior

the JRE should always be used for the training run (as long as the user did not specify BP_JVM_TYPE=jdk) and thus the CDS run should work fine

Current Behavior

Sometimes the JDK is used instead of the JRE

Possible Solution

find a way to conssitenly get the JRE at traing run

Steps to Reproduce

https://github.com/anthonydahanne/petclinic-efficient-container/blob/buildpacks/.github/workflows/tests.yml#L34C1-L46C70 or more simply:

pack build test --env BP_JVM_VERSION=21 --env BP_JVM_CDS_ENABLED=true --env BP_SPRING_AOT_ENABLED=true  -b gcr.io/paketo-buildpacks/bellsoft-liberica:latest   -b paketobuildpacks/syft:latest -b paketobuildpacks/maven:latest   -b paketobuildpacks/executable-jar:latest  -b  paketobuildpacks/spring-boot:latest -B paketobuildpacks/builder-jammy-buildpackless-tiny:latest

if during

docker run -it test

You see:

[warning][cds] Dynamic archive cannot be used: static archive header checksum verification failed.

CDS failed to apply because of a JVM mixup

Motivations

CDS should always work