Thursday, May 19, 2022

[google-cloud-sql-discuss] Re: Connection from Cloud Run to Cloud SQL instance timed out after 10s

The weird thing is that the error mentions MySQL (port 3307) where we only have Postgres. We don't use MySQL at all. Also, it seems like someone else experienced this recently: https://www.googlecloudcommunity.com/gc/Serverless/Cloud-Run-connection-to-Cloud-SQL-times-out-occassionally/m-p/424255/highlight/true#M355.
On Thursday, May 19, 2022 at 12:05:30 AM UTC+3 Agis Anastasopoulos wrote:
Hello.

We're deploying some Go 1.17 services to Cloud Run. They connect to our Cloud SQL (Postgres 13) instance using the instance's public IP address (i.e. using the SQL Proxy).

Recently, we've been observing frequent errors like this from our Cloud Run logs:

    Cloud SQL connection failed. Please see https://cloud.google.com/sql/docs/mysql/connect-run for additional details: connection to Cloud SQL instance at <public-ip>:3307 failed: timed out after 10s

This manifests in users receiving HTTP 500 responses to their requests.

I've went through the database's CPU/Memory/Disk utilization graphs and it's totally under-utilized. No suspicious warning/error logs from the database either. So it all seems good there.

Our containers use the lib/pq Postgres driver, and we set a statement_timeout = 1s to all of our connections. Our containers are configured so that there's at minimum 1 container up and running. The utilization of containers is also extremely low when this happens.

Any insights here?

After searching, I bumped onto this https://stackoverflow.com/a/27476968/1242778, talking about tweaking the TCP keepalive settings in the service running on Cloud Run.

Any help would be greatly appreciated,
Thanks in advance


--
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/cc7a8dcd-e93d-4259-a9ca-01fe3187b334n%40googlegroups.com.

No comments:

Post a Comment