Reputation: 657
Please vote up this issue with the App Engine / Cloud SQL team: https://code.google.com/p/googleappengine/issues/detail?id=11898
I'm using Go on App Engine to access Google Cloud SQL using https://github.com/go-sql-driver/mysql as my driver. As I am adding a number of transactions, I get this error:
Cloud SQL connection error 2
Searching for it on Google doesn't return any results. What does that mean? I'm getting the error when trying to start a transaction.
My code works most of the time and only fails intermittently, so I'm confident that it isn't my code or SQL statements.
UPDATE:
github.com/ziutek/mymysql
and got the exact same results. Upvotes: 3
Views: 672
Reputation: 55
I ran into similar issues using Go on App Engine with Cloud SQL that seemed to be related to the creating too many connections to the cloudsql instance. I changed my code to create a single connection to the db during init which I reused throughout the program and seems to work, similar to what is recommended here.
Upvotes: 2
Reputation: 675
I've ran into the same issue. It appeared out of nowhere. Restarting the database through GAE helped for about half an hour, but then the problem returned.
I've updated my driver and the issue seems to have gone away:
cd $GOPATH/src/github.com/go-sql-driver/mysql/
git pull
Edit: The issue came up again after that, but this time I think it was caused by the server creating a lot of transactions and not rolling them back when an error happened. Thus a lot of outstanding transactions were created, leading to a deadlock. There were "timeout" errors for a while, and then "Cloud SQL connection error 2" came back. So another suggestion is look at what happens before you start getting that error. It might just be a symptom of something else.
Upvotes: 1