-
Notifications
You must be signed in to change notification settings - Fork 119
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
support jdbc connection with unix domain socket in native image #1940
Comments
After reading the source code, I'm sure that https://github.com/GoogleCloudPlatform/native-image-support-java/blob/master/native-image-support/src/main/java/com/google/cloud/nativeimage/features/gcp/CloudSqlFeature.java in the old repository has been moved to https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/main/core/src/main/java/com/google/cloud/sql/nativeimage/CloudSqlFeature.java in this repository. But not include last PR in old repository. Which results in lost the support for unix domain sockets in the graalvm native image. If you guys manage both repositories, please merge the last PR into this one. By the way, I see that there's another issue: #217 The 'connecting directly' in that issue is means unix domain socket in graalvm native image. The last PR already solved this problem in the old repository, if merge back into this repository can also solve that issue. |
@czp3009 Thanks for the heads up. I'll port GoogleCloudPlatform/native-image-support-java#304 over to this repo. |
A quick status update: it seems like we can't port this over exactly 1:1. Perhaps there are different versions of graalvm installed. I'm looking into it. I would welcome help from someone more experienced with graalvm. |
PR #1947 is a dead end. It won't work because we need to be able to compile the source code using JDK 8, but the configuration required to add the proxy. I'm going to try again replacing core/src/main/java/com/google/cloud/sql/nativeimage/CloudSqlFeature.java with a JSON file containing the Graalvm reflection configuration. |
hi @hessjcg , i think it's a good idea to register the proxy with a JSON file, instead of replacing the entire CloudSqlFeature with JSON. for example(proxy-config.json): [
{
"interfaces": [
"jnr.unixsocket.Native$LibC",
"jnr.ffi.provider.LoadedLibrary"
]
},
{
"interfaces": [
"jnr.enxio.channels.Native$LibC",
"jnr.ffi.provider.LoadedLibrary"
]
}
] |
Ok, we are getting closer. The classes now load, but it seems like the resources JNI library resources are not being loaded correctly. When I run the test, I get this error: (See #1961)
I think that the nativeimage resource configuration is not correct yet. |
This is a fix for the graalvm configuration issues related to the jnr.unixsocket library. The proxy classes are now being properly configured for reflection and dynamic proxy. Native library files that are usually loaded as resources from jffi-1.3.13-native.jar are included in the image. Fixes #1940
Feature Description
I'm sorry I don't really know where this issue should be submit, so I'll submit it here first, and let me know if it shouldn't be.
I've looked at the previous archived repositories, but I don't know what repositories the previous functionality has been moved to.
I've submitted a PR to that repository before: GoogleCloudPlatform/native-image-support-java#304
That PR add unix domain socket supporting in graalvm native images.
But now when I add dependency according to the new documentation, I still get the same error as before this PR
I think that repository was using an older version of the code before moving it to another repository, so the code in the last batch of PRs didn't get moved to the new repository.
If this functionality should be moved to this repository, is it possible to merge the code from the previous PR to this repository?
Sample code
No response
Alternatives Considered
No response
Additional Details
No response
The text was updated successfully, but these errors were encountered: