Re: BUG #16641: Postgresql driver 42.2.15 and 42.2.16 has problems connecting to AWS RDS Postgresql database

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: frjtrifork(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16641: Postgresql driver 42.2.15 and 42.2.16 has problems connecting to AWS RDS Postgresql database
Date: 2020-10-01 23:04:49
Message-ID: CADK3HHK1BnShskc+_RGM9ZBafe-ujMc5YULGOuAcyHHBUjzkJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, 29 Sep 2020 at 06:16, PG Bug reporting form <noreply(at)postgresql(dot)org>
wrote:

> The following bug has been logged on the website:
>
> Bug reference: 16641
> Logged by: Flemming Jønsson
> Email address: frjtrifork(at)gmail(dot)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 gssEncMode=disabl the
> latest driver
> against RDS serverless that is 'stuck' at 10.7 engine - or is it something
> that can be fixed?
>
> /Flemming
>
>
Well the problem is that the driver attempts to make a GSS encrypted
connection and AWS doesn't adhere to the PostgreSQL protocol.

You can add gssEncMode=disable to the connection and the driver will not
attempt the encrypted connection.
We will be releasing shortly a version which does not default to attempting
the gssEncMode.
You really should be filing this but with Amazon as their product does not
adhere to the PostgreSQL protocol

Dave

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2020-10-02 00:08:54 Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop
Previous Message Peter Eisentraut 2020-10-01 17:24:17 Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop