Postgres connection errors TCP idle connections killed

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube Developer Edition 8.5.1.38104

  • what are you trying to achieve

We are trying to connect to a IBM Cloud Databases for Postgres instance. But in between our Kubernetes cluster and the Postgres instance is a firewall that kills idle TCP connections every 10 minutes. So our Sonarqube instance starts fine and works for about 10-15 minutes. But as soon as there is inactivity it kills the connections and the next attempt it has to connect to the Database it throws errors and cannot complete any analysis. Logs attached

sonarqube.log (8.1 KB)

  • what have you tried so far to achieve this

We are currently running with the following environment variables and it works alright but performance could probably be better since we are essentially disabling connection pooling.

SONAR_JDBC_MINIDLE=0
SONAR_JDBC_MAXIDLE=0

Any help on how we can set keepalive at the JDBC level? Or get around this problem while keeping pooling? Or maybe this should be moved to an enhancement request if that is not possible?