1

We are using AWS RDS Aurora Cluster with AWS RDS Proxy connected to a Payara Micro Application using PostgreSQL. We are receiving exceptions from time to time in our application ("PSQLException: This connection has been closed"). We identified the reason for this to be the maximum session lifetime in the RDS Proxy. As per the aws documentation:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/rds-proxy-connections.html
"Client connection max life: RDS Proxy enforces a maximum life of client connections of 24 hours. This value is not configurable. Configure your pool with a maximum connection life less than 24 hours to avoid unexpected client connection drops."

We can see, that the connection drops happen exactly at the times when the proxy closes a client connection with the message: "The client connection closed. Reason: The connection exceeded the maximum connection duration."

Therefore we are now trying to limit the max connection lifetime in our application to prevent the connection drops. We're using the Payara Micro native connection pool.

How would one achieve to limit the max connection lifetime with a standard connection pool? I know that Hikari offers this feature, but switching connection pools is not a feasible option.

We approached the AWS support and they could not provide a suitable solution about the max lifetime. However they suggested we turn on connection recycling, using the "max-connection-usage-count" property. This should help with our connection drops, but I still want to explore the option to set a max lifetime to be safe.

3
  • AFAIK the Payara connection pool is nothing more then a wrapper around the one from the provided JDBC Driver, which I assume is Postgres here. Just set the max connection time on that to something lower then 24h. Commented Jan 28 at 20:02
  • Thanks for your input. It looks like the Postgres JDBC Driver does not support a max connection time config. Commented Jan 30 at 7:44
  • Well then your only choice is to figure out if the payara one has timeout idle settings if not then the only solution is to switch datasources. Looking at the documentation there are quite some properties you could set on the payara side of things -> docs.payara.fish/enterprise/docs/5.25.0/documentation/… Commented Jan 30 at 8:11

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.