-
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
Add support for GraalVM #217
Comments
ATM I have no example code to share as it was from a private code base. :/ |
I really have no experience with GraalVM, so I'm not really sure what the problem might be. I'm not even sure the underlying API client ( One thing I see is:
which makes me think that it's actually You could try connecting directly instead of using the unix socket, which is the default behavior in the latest version. |
@kurtisvg : Regarding connecting directly, what do you mean here? From last time I checked the source code of this library (20 March), the contract was that it knew it was used inside a Cloud Run environment, and the configuring of the cloud run application needed a "configuration/mapping" setup for the application telling it should be able to connect to a given cloudsql instance. And my assumption is that this configuring made available an cloudsqlproxy instance listning on unix sockets for being able to allow the cloud run application to connect to the cloud sql database. Has this changed? Is this listening by IP-address now? (which would make it not use unix sockets) I believe no due to https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/blob/master/core/src/main/java/com/google/cloud/sql/core/CoreSocketFactory.java#L158 |
What's interesting is from my comment quarkusio/quarkus#6634 (comment) which mentions oracle/graal#1696 which shows an example of using unix sockets and the host has IPv6 interface available and throws the similar exception. I find oracle/graal#1696 (comment) particular interesting, but I tried asking both Quarkus-dev and Graalvm-dev in their respective channels about how I could "link with Linux AMD 64 bindings" (??) when I assembled the Quarkus application. Sadly I got no feedback from how to do it with my quarkus application... So it would be interesting to see if anyone else is capable of trying what is mentioned, to see if that solves connecting to cloudsql with a native binary in cloud run. This is kinda a huge blocker for Java developers that are keen on pursuing serverless infrastructure with native binaries having small memory footprint and fast startup times while depending on connecting to a database. |
In v1.0.16, we no longer attempt to guess if we are on any specific environment, and instead default to connecting via TCP. It's possible to specify you wish to connect using the unix socket, but it's typically not preferable because:
If there is something specific to this library I can do to work around this, please let me know. I suspect the root problem is a conflict between either |
Ill give this a new try during the weekend then!
Just to clarify , I'm not blaming the library here, just hoping to maybe find some GraalVM experts that might have some more insights, but maybe this wont be an issue with v1.0.16! :-) |
Roy - did upgrading to v1.0.16 work?
…On Wed, May 6, 2020 at 2:44 PM Roy Sindre Norangshol < ***@***.***> wrote:
@kurtisvg <https://github.com/kurtisvg> : Regarding connecting directly,
what do you mean here?
In v1.0.16
<https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory/releases/tag/v1.0.16>,
we no longer attempt to guess if we are on any specific environment, and
instead default to connecting via TCP.
Ill give this a new try during the weekend then!
This is kinda a huge blocker for Java developers that are keen on pursuing
serverless infrastructure with native binaries having small memory
footprint and fast startup times while depending on connecting to a
database.
If there is something specific to this library I can do to work around
this, please let me know. I suspect the root problem is a conflict between
either jnr-unixsocket or GraalVM configuration settings, and there may
not be anything specific to this library that I can do.
Just to clarify , I'm not blaming the library here, just hoping to maybe
find some GraalVM experts that might have some more insights, but maybe
this wont be an issue with v1.0.16! :-)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#217 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIVLDSWU6SSYIRAZJMQYNTRQHK43ANCNFSM4MZY65LA>
.
--
* • **Les Vogel*
* • *Cloud Developer Relations
* • *[email protected]
* • *+1-4 <%2B1-650-338-7103>08-676-7023
|
Sorry, I had personal matter that needed my attention this weekend @lesv, I'll research some time tonight from 20:00 to 21:30 to see if I can get something done for testing this. If unable to do it this evening, I'll have a look at it the following weekend. Apologize for this. |
So errors while deserializing into a POJO from the response body from the metaserver while retrieving a token? Added some more stuff to my configuration and seem to get past this error now by providing the following maven configuration:
Together with the reflection-config.json content of:
But now Im treated with :
Sadly Another ugly side effect is that quarkus is logging the jdbc url with the secrets (but this is something Quarkus should fix) :
|
Have a look by checking https://github.com/norrs/quarkus-quickstarts/tree/mysql_cloudrun_cloudsql/hibernate-orm-panache-quickstart . A hint for compiling and deploying can be done by :
Notice after the first deploy, you need to edit the cloud run deployment and add the Cloud SQL and you need to add two additional properties, |
This time I tried MySQL btw and not PostgreSQL. I can also jump on a meet session if that is helpful, my timezone is CEST. (GMT+2). Time for 💤 now. |
Looks to me like the problem is originating from the google-api-client:
So it looks like we've traded one dependency issue for another unfortunately. @lesv - have you tried any of the generated libraries with GraalVM before? |
I haven't had the opportunity to experiment with GraalVM, so any suggestions are welcome. I don't think this is necessarily a blocker, as Cloud Run now has Serverless VPC access in beta. This means it's possible to connect directly to Cloud SQL via Private IP without the use of this library. |
Because I got stuck on this two months ago, I thought it may be worthwhile sharing some of my findings too PostgreSQL does not seems to be supported due the fact the driver users jnr-ffi and that does not seems to be supported. I tried mysql, but according to the micronaut docs, there seems to be an issue with mysql driver too: issue I got mariadb driver to work in a native build using SQL proxy not this connector. Trying to use the connector I had several issues with our GCP libraries and SSL, after creating my own SocketFactory for mariadb, I got past the errors on the DB and then issues happened at the auth libraries. Followed all the instructions on the doc mentioned here (just happens I work at google and have access to the doc too), but still had issues with several of our libraries. I got stuck at the Keystore throwing NPE, even after bundling the cacerts with the application as instructed. I have not tried the VPC service connector, that may be a good approach, as mariadb driver works fine to write native code with micronaut at least. |
@kurtisvg : So the sad part about Serverless VPC access is additional charges for network traffic, it might be fine for larger enterprises who has too much money 🙃 |
GraalVM is taking off, and many apps will need a SQL story with it... |
Another thing I bumped into, after being able to deploy the micronaut + cloud sql using VPC connector is that the image is consuming all available memory that is given to it. As reported here: oracle/graal#2428 seems to be an issue that some GraalVM applications have. I noticed that the java version does not "leak" memory, it does however requires more memory to start, and takes way longer to bootstrap too, but at least its not having GC issues. |
Update on this: we're currently blocked from moving forward on GraalVM support because the SQLAdmin API client, which the socket factory depends on, is not supported. |
Question
How may I connect to CloudSQL via Cloud Run using a native binary with graalvm?
(I tried Quarkus and couldn't get it working with native binary, but it worked with JVM.)
I got stuck with the following stacktrace:
Additional Context
quarkusio/quarkus#6634
quarkusio/quarkus#6634 (comment)
The text was updated successfully, but these errors were encountered: