Skip to content
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

Not up-to-date documentation in guide for using Cloud SQL with native executables #43876

Closed
daniel-pettersson-pricer opened this issue Oct 15, 2024 · 1 comment · Fixed by #43901
Assignees
Milestone

Comments

@daniel-pettersson-pricer

Describe the bug

When following the guide in https://quarkus.io/guides/deploying-to-google-cloud#using-cloud-sql-with-native-executables on how to use Cloud SQL with native executables. I found that it only worked when the version of my postgres-socket-factory dependency was <= 1.15.2 (probably same for other db vendors as well).

When using a more recent postgres-socket-factory would give the following output in the native build:

Error: Detected an active instance of Cleanable or jdk.internal.ref.Cleaner in the image heap. This usually means that a resource such as a Timer, native memory, a file descriptor or another resource is reachable which is not available at image runtime. If these objects should not be stored in the image heap, you can use 
    '--trace-object-instantiation=jdk.internal.ref.CleanerImpl$PhantomCleanableRef'
to find classes that instantiate these objects. Once you found such a class, you can mark it explicitly for run time initialization with 
    '--initialize-at-run-time=<culprit>'
to prevent the instantiation of the object.

So I followed the tip in the output and ran the build with:
quarkus.native.additional-build-args=--trace-object-instantiation=jdk.internal.ref.CleanerImpl$PhantomCleanableRef

This gave me:

Error: Detected an active instance of Cleanable or jdk.internal.ref.Cleaner in the image heap. This usually means that a resource such as a Timer, native memory, a file descriptor or another resource is reachable which is not available at image runtime. Prevent such objects being used during image generation, including by class 
The culprit object has been instantiated by the 'com.kenai.jffi.Library$DefaultLibrary' class initializer with the following trace:
        at jdk.internal.ref.CleanerImpl$PhantomCleanableRef.<init>(CleanerImpl.java:164)

So I tried doing the build with:

quarkus.native.additional-build-args=--initialize-at-run-time=jnr.ffi.provider.jffi.NativeFinalizer$SingletonHolder\\,com.kenai.jffi.Library$DefaultLibrary

And this works fine. So the guide would need some updating to reflect this.

Expected behavior

The application should work when following the guide.

Actual behavior

The application does not build when following the build using the latest version of suggested dependencies.

How to Reproduce?

Follow the guide in https://quarkus.io/guides/deploying-to-google-cloud to deploy a native build of a Quarkus application that uses Cloud SQL with a JDBC driver.

Output of uname -a or ver

Linux sto-447975 6.10.12-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Sep 30 21:38:25 UTC 2024 x86_64 GNU/Linux

Output of java -version

openjdk version "21.0.4" 2024-07-16 OpenJDK Runtime Environment (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7) OpenJDK 64-Bit Server VM (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7, mixed mode, sharing)

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.15.1

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd342

Additional information

No response

@quarkus-bot
Copy link

quarkus-bot bot commented Oct 15, 2024

/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel,native-image)

@zakkak zakkak self-assigned this Oct 16, 2024
zakkak added a commit to zakkak/quarkus that referenced this issue Oct 16, 2024
zakkak added a commit to zakkak/quarkus that referenced this issue Oct 16, 2024
@quarkus-bot quarkus-bot bot added this to the 3.17 - main milestone Oct 16, 2024
@gsmet gsmet modified the milestones: 3.17 - main, 3.15.2 Oct 18, 2024
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 21, 2024
Closes quarkusio#43876

(cherry picked from commit 489f919)
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 21, 2024
Closes quarkusio#43876

(cherry picked from commit 489f919)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants