GoogleCloudPlatform / GoogleCloudPlatform/spring-cloud-gcp

SSLHandshakeException: Received fatal alert: bad_certificate

Open
#3,901 3 comments 0 reactions 0 assignees View on GitHub
priority: p3 type: bug
Dominant language
Java
Stars
551
Forks
349
Avg merge
1d 13h
Merged PRs (30d)
14

Description

### Bug Description
Spring Boot application(s) are experiencing an inconsistent issue where your SSL connection between Cloud Run and Cloud SQL works reliably for about a month before consistently failing.

### Stacktrace
`
javax.net.ssl.SSLHandshakeException: Received fatal alert: bad_certificate at sun.security.ssl.Alert.createSSLException at sun.security.ssl.Alert.createSSLException at sun.security.ssl.TransportContext.fatal at sun.security.ssl.Alert$AlertConsumer.consume at sun.security.ssl.TransportContext.dispatch at sun.security.ssl.SSLTransport.decode at sun.security.ssl.SSLSocketImpl.decode at sun.security.ssl.SSLSocketImpl.readApplicationRecord at sun.security.ssl.SSLSocketImpl$AppInputStream.read at org.postgresql.core.VisibleBufferedInputStream.readMore ( org/postgresql.core/VisibleBufferedInputStream.java:192 ) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes ( org/postgresql.core/VisibleBufferedInputStream.java:159 ) at org.postgresql.core.VisibleBufferedInputStream.ensureBytes ( org/postgresql.core/VisibleBufferedInputStream.java:144 ) at org.postgresql.core.VisibleBufferedInputStream.read ( org/postgresql.core/VisibleBufferedInputStream.java:76 ) at org.postgresql.core.PGStream.receiveChar ( org/postgresql.core/PGStream.java:476 ) at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL ( org/postgresql.core.v3/ConnectionFactoryImpl.java:607 ) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect ( org/postgresql.core.v3/ConnectionFactoryImpl.java:201 ) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl ( org/postgresql.core.v3/ConnectionFactoryImpl.java:268 ) at org.postgresql.core.ConnectionFactory.openConnection ( org/postgresql.core/ConnectionFactory.java:54 ) at org.postgresql.jdbc.PgConnection. ( org/postgresql.jdbc/PgConnection.java:273 ) at org.postgresql.Driver.makeConnection ( org/postgresql/Driver.java:446 ) at org.postgresql.Driver.connect ( org/postgresql/Driver.java:298 ) at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver ( org/apache.tomcat.jdbc.pool/PooledConnection.java:346 ) at org.apache.tomcat.jdbc.pool.PooledConnection.connect ( org/apache.tomcat.jdbc.pool/PooledConnection.java:227 ) at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection ( org/apache.tomcat.jdbc.pool/ConnectionPool.java:779 ) at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection ( org/apache.tomcat.jdbc.pool/ConnectionPool.java:707 ) at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection ( org/apache.tomcat.jdbc.pool/ConnectionPool.java:199 ) at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection ( org/apache.tomcat.jdbc.pool/DataSourceProxy.java:133 ) ....
`

### Environment

1. OS Type and version: Docker, Ubuntu Jammy
2. Java version: Eclipse Temurin 21
3. Google Cloud: Cloud Run, Cloud SQL Postgres
 
### Additional Details

We have initially opened an incident with Google Support for this issue, Case 58576713. Based on initial investigation, no issues were found with Cloud Run or Cloud SQL. Recommendation from Google support team that the most effective next step is to file an issue directly with the spring-cloud-gcp project on GitHub.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.