-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
AppCDS Archive Generation with quarkus-container-image-jib causes a timestamp mismatch #38057
Comments
/cc @geoand (jib) |
Thanks for the report! As you seem to have done an analysis on the source code, would you be interested in providing a fix? |
I just compiled the Quarkus main branch and used it to generate the image and could not replicate this issue as the timestamp was properly carried over to the final image. I did this twice. I then went back to Quarkus 3.6.4 and the issue happened again. So I'd say this has been fixed, although I do not see any new commits in the relevant sections of code - only #37647 which at first glance I'd say is unrelated to this issue I was having, but maybe it is related? In any case, it seems like the next version of Quarkus should fix this for us. |
Thanks for checking! |
Hello, I checked with quarkus version 3.7.1 released yesterday, it is failling with this:
I don't know if it is my particular setup that cause the fails, i'm happy to help if you need further infos. |
I'll check again soon |
Thank you! 👌 |
I could not reproduce the problem this time either |
It's weird, I had the same issue with version 3.6.x, but when I switched to the main branch, the problem disappeared. What's really strange is that I didn't see any code changes between 3.6.x and the main branch that could explain this. Makes me think there might be a sneaky bug hiding somewhere. |
Re-tested with 3.7.2. It is weird, i have two project, one is fine, the other is not working. The one not working is on java 21, maybe this or the fact that I use a custom image without sha 256 is the root cause. I will investigate more. |
I think I found the bug. or i'm not sure if it is a bug or the normal behaviour. package com.acme;
import io.quarkus.runtime.Quarkus;
import io.quarkus.runtime.QuarkusApplication;
import io.quarkus.runtime.annotations.QuarkusMain;
@QuarkusMain
public class Main {
public static void main(String... args) {
Quarkus.run(MyApp.class, args);
}
public static class MyApp implements QuarkusApplication {
@Override
public int run(String... args) throws Exception {
System.out.println("Do startup logic here");
Quarkus.waitForExit();
return 0;
}
}
} This mean: Basic autogenerated quarkusmain or defined quarkusmain but without the public static class that extend quarkusapplication, then it does not work. |
Do you mind sharing the application that you came up with that reproduces the problem? Thanks |
Just to note, I also got this error again on
|
Sure |
Hello, |
Thanks for checking! I'll close this and if someone comments it's still an issue, we can reopen |
Describe the bug
When creating an AppCDS Archive with container image generation through the quarkus-container-image-jib extension, the following Docker command gets executed:
docker run -v /Users/my-user/repos/my-service/target:/tmp/quarkus:z -w /tmp/quarkus/quarkus-app --rm registry.access.redhat.com/ubi8/openjdk-21-runtime:1.18 java -XX:ArchiveClassesAtExit=app-cds.jsa -Dquarkus.appcds.generate=true -jar quarkus-run.jar
This command mounts the
/target
folder as a volume, which contains the library folders/quarkus-app/lib/boot
and/quarkus-app/lib/main
. This means that the AppCDS archive will be generated with the .jar files that are inside these two folders.The issue is that after the AppCDS archive generation process, in the
quarkus-container-image-jib
image generation, the.jar
files inside the/quarkus-app/lib/boot
and/quarkus-app/lib/main
folders are copied into the image in a way that causes their timestamp to change. Seequarkusio/quarkus/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java
to see how this is done.As an example, when building the AppCDS, these are the files inside the /lib/boot folder:
And these are the files inside the final container:
As you can see, the timestamps are different, which causes the error when CDS tries to load up the archive:
I would suggest changing the layer creation in the
quarkus-container-image-jib
to ensure that the timestamps are not changed. A common solution for this is to tar the files before moving them to a layer in the image.Expected behavior
All the libraries that are used when generating the AppCDS archive must be exactly the same as the ones used when creating the image.
Actual behavior
No response
How to Reproduce?
No response
Output of
uname -a
orver
Darwin <computer_name> 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64 arm Darwin
Output of
java -version
openjdk version "21.0.1" 2023-10-17 OpenJDK Runtime Environment (build 21.0.1+12-29) OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)
Quarkus version or git rev
Quarkus 3.6.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.8.6
Additional information
No response
The text was updated successfully, but these errors were encountered: