BUG #16641: Postgresql driver 42.2.15 and 42.2.16 has problems connecting to AWS RDS Postgresql database - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #16641: Postgresql driver 42.2.15 and 42.2.16 has problems connecting to AWS RDS Postgresql database
Date
Msg-id 16641-e8ea5e56aa47bd30@postgresql.org
Whole thread Raw
Responses Re: BUG #16641: Postgresql driver 42.2.15 and 42.2.16 has problems connecting to AWS RDS Postgresql database  (Dave Cramer <davecramer@postgres.rocks>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      16641
Logged by:          Flemming Jønsson
Email address:      frjtrifork@gmail.com
PostgreSQL version: 10.7
Operating system:   AWS RDS Serverless
Description:

I have a Spring Boot application in production in AWS Elastic Container
Service.

With Spring Boot 2.3.3 the postgresql driver 42.2.14 is used and the
application connects without issues to the AWS RDS serverless postgresql
10.7 engine.
I know you support 10.14 currently, but 10.7 is the latest postgresql
version that can be configured in RDS serverless - so I'm hoping it is ok to
file this issue.

After upgrading to Spring Boot 2.3.4 the postgresql driver 42.2.16 was
included and our application could no longer connect to RDS.
We consistently get this stacktrace on startup with 42.2.16 (for the record
42.2.15 seem to produce the same stacktrace):

Caused by: org.flywaydb.core.internal.exception.FlywaySqlException:
--
  | Unable to obtain connection from database: The connection attempt
failed.
  |
-------------------------------------------------------------------------
  | SQL State : 08001
  | Error Code : 0
  | Message : The connection attempt failed.
  | at
org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:65)
~[flyway-core-6.4.4.jar:na]
  | at
org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80)
~[flyway-core-6.4.4.jar:na]
  | at org.flywaydb.core.Flyway.execute(Flyway.java:456)
~[flyway-core-6.4.4.jar:na]
  | at org.flywaydb.core.Flyway.migrate(Flyway.java:159)
~[flyway-core-6.4.4.jar:na]
  | at

org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:65)
~[spring-boot-autoconfigure-2.3.4.RELEASE.jar:2.3.4.RELEASE]
  | at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
  | at

org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
~[spring-beans-5.2.9.RELEASE.jar:5.2.9.RELEASE]
  | ... 27 common frames omitted
  | Caused by: org.postgresql.util.PSQLException: The connection attempt
failed.
  | at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:315)
~[postgresql-42.2.16.jar:42.2.16]
  | at
org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51)
~[postgresql-42.2.16.jar:42.2.16]
  | at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225)
~[postgresql-42.2.16.jar:42.2.16]
  | at org.postgresql.Driver.makeConnection(Driver.java:465)
~[postgresql-42.2.16.jar:42.2.16]
  | at org.postgresql.Driver.connect(Driver.java:264)
~[postgresql-42.2.16.jar:42.2.16]
  | at
com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
~[HikariCP-3.4.5.jar:na]
  | at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
~[HikariCP-3.4.5.jar:na]
  | at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
~[HikariCP-3.4.5.jar:na]
  | at
com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
~[HikariCP-3.4.5.jar:na]
  | at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560)
~[HikariCP-3.4.5.jar:na]
  | at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
~[HikariCP-3.4.5.jar:na]
  | at
com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
~[HikariCP-3.4.5.jar:na]
  | at
org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
~[flyway-core-6.4.4.jar:na]
  | ... 33 common frames omitted
  | Caused by: java.io.EOFException: null
  | at org.postgresql.core.PGStream.receiveChar(PGStream.java:443)
~[postgresql-42.2.16.jar:42.2.16]
  | at
org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:436)
~[postgresql-42.2.16.jar:42.2.16]
  | at
org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:144)
~[postgresql-42.2.16.jar:42.2.16]
  | at
org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:213)
~[postgresql-42.2.16.jar:42.2.16]
  | ... 45 common frames omitted


If I upgrade to Spring Boot 2.3.4 and force the postgresql driver to stay at
42.2.14 our application works nicely in AWS ECS and connects to the
serverless RDS Postgresql database without problems.
I filed a workaround for Spring Boot maven in the Spring Boot issue tracker
here https://github.com/spring-projects/spring-boot/issues/23523 

Is this above stack trace a known feature when using the latest driver
against RDS serverless that is 'stuck' at 10.7 engine - or is it something
that can be fixed?

/Flemming


pgsql-bugs by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column
Next
From: Daniel Gustafsson
Date:
Subject: Re: BUG #16640: Documentation table formatting issue