I have created a Cloud SQL instance (Postgres) and connected to it from Cloud Run through Serverless VPC connectors.
I get one of the following errors constantly
-
The database system is in recovery mode (Cloud SQL)
-
PSQLException: An I/O error occurred while sending to the backend (Cloud Run)
-
PSQLException: SSL error: Remote host terminated the handshake (Cloud Run)
-
PSQLException: The connection attempt failed (Cloud Run)
-
LOG: could not receive data from client: Connection reset by peer (Cloud SQL)
This has been bugging us for a long time and would like to get a clear idea of the problem.
Hi @aswath-s ,
Welcome to Google Cloud Community!
These errors indicate that there may be issues with the connection between your Cloud SQL instance and your Cloud Run service, or issues with the configuration of your Cloud SQL instance.
- The “database system is in recovery mode” error occurs when the database is in the process of recovering from a crash or other interruption. This can occur if there was a problem with the server or network connection, or if the database was not shut down properly.
- The “An I/O error occurred while sending to the backend” error can occur if there is a problem with the network connection between Cloud SQL and Cloud Run, or if the Cloud Run service is not able to connect to the Cloud SQL instance.
- The “SSL error: Remote host terminated the handshake” error can occur if there is a problem with the SSL certificate used to encrypt the connection between Cloud SQL and Cloud Run.
- The “The connection attempt failed” error can occur if there is a problem with the network connection between Cloud SQL and Cloud Run, or if the Cloud Run service is not able to connect to the Cloud SQL instance.
- The “could not receive data from client: Connection reset by peer” error can occur if there is a problem with the network connection between Cloud SQL and Cloud Run, or if the Cloud Run service is not able to connect to the Cloud SQL instance.
I would recommend checking the Network connectivity between Cloud SQL and Cloud Run, ensure that the correct firewall rules are set up to allow traffic between them, and ensure that the Cloud SQL instance is properly configured and the SSL certificate is valid.
Thank you