Wednesday, September 19, 2018

[google-cloud-sql-discuss] Bizarre issues using Slick 3.2.3 + HikariCP + CloudSQL

Hi,
We are getting some very strange issues. We use Scala in App Engine Standard (Java8) with a 2nd generation Cloud SQL (MySQL).

It's like some result sets are getting parsed on the wrong thread or something. 
Some examples include:
java.lang.ClassCastException: java.lang.Integer cannot be cast to <our domain model>
java.sql.SQLException: ResultSet is from UPDATE. No Data.

The really bizarre thing is that this only happens once in a blue moon; say once a day for ~20 requests somewhat nearby in time, out of thousands and thousands of requests. 

We are using the correct Java8 connection string, like this from the Cloud SQL App Engine Standard docs.
jdbc:mysql://google/${CLOUD_SQL_DATABASE}?cloudSqlInstance=${CLOUD_SQL_INSTANCE}&socketFactory=com.google.cloud.sql.mysql.SocketFactory&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC

How does this relate to GAE & Cloud SQL?
Being in GAE seems to be preventing us from troubleshooting for these reasons:
(1) I cannot tell which version of mysql-connector-j is being used. The dependency is swapped out at runtime in some way; from the stacktraces it's clear that the ordinary MySQL connector 5.1.42 is not being used, and the documentation has comments that say "only used locally" for this dependency. If we were able to control the version of mysql-connector-j, then we would use a known good version that is tested with Slick + HikariCP.
(2) This seems to have started happening when we switched to correctly using the com.google.cloud.sql.mysql.SocketFactory . Could there be a bug with this socket factory, or some weird incompatibility with HikariCP or Slick?

I really appreciate any hints to point me in the right direction, this is a pretty brutal problem as the stacktraces are very deep in the MySQL connector code (which is some custom Google version) so I am basically helpless at troubleshooting in any useful way since the stacktraces don't line up with the code.


--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/7ed1152d-d2b9-41f4-b837-e0df27c874e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment