Must-share information (formatted with Markdown):
- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
sonarqube9.8 - how is SonarQube deployed: zip, Docker, Helm
zip - what are you trying to achieve
Our database setup is based on a Patroni cluster. At the moment SQ is directly connected to master db node. But we want to put a load balancer in between SQ server and patroni. We tried this change. Sonar re-started. After a few minutes we were seeing connection timeouts for db connection pool. This makes many pipelines to fail or loading global configuration fails too. - what have you tried so far to achieve this
We have gone through this thread
DB connections get stuck timing out - #4 by Q_Jones
This tells to set some timeout config in sonar.properties. Could you please elaborate about this config. If our loadbalancer timeout is set to 120 secs at the moment, which of the following properties needs calibration.
sonar.jdbc.idleTimeout
, default 600000
sonar.jdbc.keepaliveTime
, default 300000
sonar.jdbc.maxLifetime
, default 1800000
sonar.jdbc.validationTimeout
, default 5000
Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
Error that we got in web.log
2023.03.20 07:52:44 ERROR web[AYb9pdV3N7uPTcHQAAik][o.s.s.w.WebServiceEngine] Fail to process request http://mycompanyserver/api/settings/values.protobuf?
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 10014ms.
### The error may exist in org.sonar.db.component.ComponentMapper
### The error may involve org.sonar.db.component.ComponentMapper.selectByKeyAndBranchOrPr
### The error occurred while executing a query
### Cause: java.sql.SQLTransientConnectionException: HikariPool-1 - Connection is not available, request timed out after 10014ms.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
======== Also the below warning
2023.03.20 22:33:15 WARN ce[][c.z.h.pool.PoolBase] HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@7d5a5364 (This connection has been closed.). Possibly consider using a shorter maxLifetime value.