Sonar is stopped or not running

I am trying to install sonarqube and integrate with GCP-SQL’s Postgres server (Public IP).

Sonar version: sonarqube-7.9.1
PostgreSQL version: 12

Issue I am facing:

I am atleast trying to connect sonar with public ip postgres server, and i am facing below error.

2020.08.25 02:31:08 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
### The error may exist in org.sonar.db.rule.RuleMapper
### The error may involve org.sonar.db.rule.RuleMapper.selectParamsByRuleKeys-Inline
### The error occurred while setting parameters
### SQL: select             p.id as "id",     p.rule_id as "ruleId",  

Script Used for setup:

yum update -y
yum install wget unzip -y
yum install postgresql -y

useradd centos
groupadd sonar
useradd -d /opt/sonarqube -g sonar -s /bin/bash sonar
echo "xxxxxxxxxx" |  passwd --stdin sonar
usermod -a -G sonar centos

curl -O https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz
tar zxvf openjdk-11.0.1_linux-x64_bin.tar.gz
mv jdk-11.0.1 /usr/local/
chmod -R 755 /usr/local/jdk-11.0.1
echo "JAVA_HOME=/usr/local/jdk-11.0.1" >> /etc/profile
echo 'PATH=$JAVA_HOME/bin:$PATH' |  tee -a /etc/profile
source /etc/profile
java -version

wget https://binaries.sonarsource.com/Distribution/sonarqube/sonarqube-7.9.1.zip
unzip sonarqube-7.9.1.zip
mv -v sonarqube-7.9.1/* /opt/sonarqube
chown -R centos:sonar /opt/sonarqube
ulimit -n 65535
sudo sh -c "cat >>/etc/security/limits.conf" <<-EOF

* soft     nproc          65535
* hard     nproc          65535
* soft     nofile         65535
* hard     nofile         65535
root soft     nproc          65535
root hard     nproc          65535
root soft     nofile         65535
root hard     nofile         65535
EOF

sudo sh -c "cat >>/etc/sysctl.conf" <<-EOF
vm.max_map_count=262144
fs.file-max = 65535
EOF

sudo sysctl -p
sed -i '1iRUN_AS_USER=centos' /opt/sonarqube/bin/linux-x86-64/sonar.sh
sudo sh -c "cat >>/opt/sonarqube/conf/sonar.properties" <<-EOF
sonar.jdbc.username=postgres
sonar.jdbc.password=xxxxxxxxxx
sonar.jdbc.url=jdbc:postgresql://xxxxxxxxxx/postgres
sonar.web.host=0.0.0.0
sonar.web.port=9000
sonar.path.data=data
sonar.path.temp=temp
EOF
sudo su -c '/opt/sonarqube/bin/linux-x86-64/sonar.sh start' - centos

web.log

2020.08.25 02:30:46 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2020.08.25 02:30:47 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2020.08.25 02:30:48 INFO  web[][o.e.p.PluginsService] no modules loaded
2020.08.25 02:30:48 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2020.08.25 02:30:48 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2020.08.25 02:30:48 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2020.08.25 02:30:50 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2020.08.25 02:30:50 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.9.1.27448 / e0c45c97bb2e45d52629f3422ac91718020f6db9
2020.08.25 02:30:50 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://XX.XXX.XXX.XXX/postgres(Edited public ip here)
2020.08.25 02:30:54 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonarqube
2020.08.25 02:30:54 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Git / 1.8.0.1574 / aec3dc8f5228aabd218e1cd31ac6e6515a43715d
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin GitHub Authentication for SonarQube / 1.5.0.870 / 153f7c7af7a264adb0fcbe5fee87bdd140a6a3a1
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin JaCoCo / 1.0.2.475 / b79a4724f3a9af1051266b4f8ca0460977295ead
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin LDAP / 2.2.0.608 / 79dc3fa4393a29667673c70182f3016288b548b7
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SAML 2.0 Authentication for SonarQube / 1.1.0.181 / 16fcb5be2d3bcfee8920b29cd758d8b957a18acb
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 7.15.0.8572 / e0ad49e38a28a8fc333ba746fc998e48678f6a8b
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarCSS / 1.1.1.1010 / 365e21fd0cb9035669fc59f6fec7c8fd28a7303b
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarFlex / 2.5.1.1831 / a0c44437f6abb0feec76edd073f91fec64db2a6c
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarGo / 1.1.1.2000 / 40d55921c7a63b67386a053490d17b6723a46cd5
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarHTML / 3.1.0.1615 / 4181edb5eff5605bec82dc0aa15ecd70eaa5857f
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 5.2.1.7778 / 49f34eaeaad59868d4353d89b1fc5c02bbe51976
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 5.13.1.18282 / 568f8ed2349f48e250a9329895b9a870100dfbeb
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarKotlin / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 3.2.0.4868 / ec66bd5f8490677eb0ebae82aa17c2a5d9c0e5e7
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.14.1.3143 / eed7b315b6116fe462a19c771013bf3891c92a97
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarRuby / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarScala / 1.5.0.315 / 4ff3a145a58f3f84f1b39846a205a129d742e993
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.9.0.3766 / 4a4080b78001a78d758d1d0fa0190fb9496b6f57
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarVB / 7.15.0.8572 / e0ad49e38a28a8fc333ba746fc998e48678f6a8b
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 2.0.1.2020 / c5b84004face582d56f110e24c29bf9c6a679e69
2020.08.25 02:30:55 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Svn / 1.9.0.1295 / 942e075773975354e32691a60bfd968065703e04
2020.08.25 02:30:57 INFO  web[][o.s.s.p.d.m.c.PostgresCharsetHandler] Verify that database charset supports UTF8
2020.08.25 02:30:57 INFO  web[][o.s.s.p.w.MasterServletFilter] Initializing servlet filter org.sonar.server.ws.WebServiceFilter@6aa043d [pattern=UrlPattern{inclusions=[/api/system/migrate_db.*, ...], exclusions=[/api/properties*, ...]}]
2020.08.25 02:30:57 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2020.08.25 02:30:59 INFO  web[][o.s.s.p.UpdateCenterClient] Update center: https://update.sonarsource.org/update-center.properties (no proxy)
2020.08.25 02:31:00 INFO  web[][o.s.s.s.LogServerId] Server ID: 663F6ED2-AXPnrsJBvj3L7DQhrfT1
2020.08.25 02:31:00 WARN  web[][o.s.s.a.LogOAuthWarning] For security reasons, OAuth authentication should use HTTPS. You should set the property 'Administration > Configuration > Server base URL' to a HTTPS URL.
2020.08.25 02:31:00 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/plugins/download
2020.08.25 02:31:00 WARN  web[][o.s.a.s.w.WebService$Action] The response example is not set on action api/permissions/search_templates
2020.08.25 02:31:00 INFO  web[][o.s.s.t.TelemetryDaemon] Sharing of SonarQube statistics is enabled.
2020.08.25 02:31:00 INFO  web[][o.s.s.n.NotificationDaemon] Notification service started (delay 60 sec.)
2020.08.25 02:31:00 INFO  web[][o.s.s.s.GeneratePluginIndex] Generate scanner plugin index
2020.08.25 02:31:00 INFO  web[][o.s.s.s.RegisterPlugins] Register plugins
2020.08.25 02:31:01 INFO  web[][o.s.s.s.RegisterMetrics] Register metrics
2020.08.25 02:31:01 INFO  web[][o.s.s.r.RegisterRules] Register rules
2020.08.25 02:31:08 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
### The error may exist in org.sonar.db.rule.RuleMapper
### The error may involve org.sonar.db.rule.RuleMapper.selectParamsByRuleKeys-Inline
### The error occurred while setting parameters
### SQL: select             p.id as "id",     p.rule_id as "ruleId",     p.name as "name",     p.param_type as "type",     p.default_value as "defaultValue",     p.description as "description"         from       rules_parameters p     inner join rules r on       r.id=p.rule_id     where                   (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plug...........................................
....................................................(Edited here same repeated:or           (r.plugin_name=? AND r.plugin_rule_key=?))
.............................................
    or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)
### Cause: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
        at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
        at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
        at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
        at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
        at com.sun.proxy.$Proxy40.selectParamsByRuleKeys(Unknown Source)
        at org.sonar.db.DatabaseUtils.executeLargeInputs(DatabaseUtils.java:134)
        at org.sonar.db.DatabaseUtils.executeLargeInputs(DatabaseUtils.java:119)
        at org.sonar.db.DatabaseUtils.executeLargeInputs(DatabaseUtils.java:108)
        at org.sonar.db.rule.RuleDao.selectRuleParamsByRuleKeys(RuleDao.java:228)
        at org.sonar.server.rule.CachingRuleFinder.retrieveRuleParameters(CachingRuleFinder.java:90)
        at org.sonar.server.rule.CachingRuleFinder.buildRulesByRuleDefinitionDto(CachingRuleFinder.java:78)
        at org.sonar.server.rule.CachingRuleFinder.<init>(CachingRuleFinder.java:67)
        at org.sonar.server.rule.WebServerRuleFinderImpl.startCaching(WebServerRuleFinderImpl.java:46)
        at org.sonar.server.rule.RegisterRules.start(RegisterRules.java:149)
        at org.sonar.core.platform.StartableCloseableSafeLifecyleStrategy.start(StartableCloseableSafeLifecyleStrategy.java:40)
        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
		at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
        at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
        at org.picocontainer.behaviors.Stored.start(Stored.java:110)
        at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:90)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:47)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:83)
        at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:46)
        at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:80)
        at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:196)
        at org.sonar.server.platform.Platform.access$400(Platform.java:46)
        at org.sonar.server.platform.Platform$1.lambda$doRun$1(Platform.java:121)
        at org.sonar.server.platform.Platform$AutoStarterRunnable.runIfNotAborted(Platform.java:371)
        at org.sonar.server.platform.Platform$1.doRun(Platform.java:121)
        at org.sonar.server.platform.Platform$AutoStarterRunnable.run(Platform.java:355)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:335)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
		at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:143)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:132)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:94)
        at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:64)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
        at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)
        at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
        at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
        ... 35 common frames omitted
Caused by: javax.net.ssl.SSLProtocolException: Connection reset by peer (Write failed)
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
        at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:988)
        at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
        at java.base/java.io.BufferedOutputStream.write(BufferedOutputStream.java:127)
        at java.base/java.io.FilterOutputStream.write(FilterOutputStream.java:108)
        at org.postgresql.core.PGStream.sendInteger4(PGStream.java:226)
        at org.postgresql.core.v3.QueryExecutorImpl.sendBind(QueryExecutorImpl.java:1561)
        at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1805)
        at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1328)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:300)
		... 49 common frames omitted
Caused by: java.net.SocketException: Connection reset by peer (Write failed)
        at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
        at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
        at java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:320)
        at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:983)
        ... 57 common frames omitted
2020.08.25 02:31:08 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2020.08.25 02:31:08 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped

Hi,

Your web.log makes it pretty clear the problem is in talking to the database. Presumably your initial connection was fine, but write is failing. You need to look there.

 
HTH,
Ann

Hi Ann,

I tried to give the GCP postgres DB’s superuser privileges and also tried with newer versions of sonar/ postgres. But same result i end up at below error. Can u pls help with postgres DB settings and what might i have missed.

Directly in the DB i am able to query with sonar user.

2020.08.28 03:16:10 INFO  web[][o.s.s.r.RegisterRules] Disable rule external_tslint:comment-format
2020.08.28 03:16:10 INFO  web[][o.s.s.r.RegisterRules] Disable rule external_tslint:no-duplicated-branches
2020.08.28 03:16:10 INFO  web[][o.s.s.r.RegisterRules] Disable rule squid:S3340
2020.08.28 03:16:11 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
### The error may exist in org.sonar.db.rule.RuleMapper
### The error may involve org.sonar.db.rule.RuleMapper.selectIndexingRulesByUuids-Inline
### The error occurred while setting parameters
### SQL: select       r.uuid as "uuid",       r.plugin_name as "repository",       r.plugin_rule_key as "pluginRuleKey",       r.name as "name",       r.description as "description",       r.description_format as "descriptionFormat",       r.priority as "severity",       r.status as "status",       r.is_template as "isTemplate",       r.is_external as "isExternal",       r.system_tags as "systemTags",       r.security_standards as "securityStandards",       t.plugin_rule_key as "templateRuleKey",       t.plugin_name as "templateRepository",       r.plugin_config_key as "internalKey",       r.language as "language",       r.rule_type as "type",       r.created_at as "createdAt",       r.updated_at as "updatedAt"     from rules r     left outer join rules t on t.uuid = r.template_uuid    

web.log (268.4 KB)

Hi Ann,

Me too facing same issue after upgrading postgres 12.4 to 12.11 sonar stopped working while starting I am getting same exception. Below is the exception and any help would help us.

2022.07.07 17:20:17 INFO  web[][o.s.s.r.RegisterRules] Register rules
2022.07.07 17:20:21 ERROR web[][o.s.s.p.Platform] Background initialization failed. Stopping SonarQube
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database.  Cause: org.postgresql.util.PSQLException: An I/O error occurred while sending to the backend.
### The error may exist in org.sonar.db.rule.RuleMapper
### The error may involve org.sonar.db.rule.RuleMapper.selectParamsByRuleKeys-Inline
### The error occurred while setting parameters
### SQL: select             p.id as "id",     p.rule_id as "ruleId",     p.name as "name",     p.param_type as "type",     p.default_value as "defaultValue",     p.description as "description"         from       rules_parameters p     inner join rules r on       r.id=p.rule_id     where                   (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin_name=? AND r.plugin_rule_key=?)         or           (r.plugin@@@                                                                                                                                                      

Caused by: javax.net.ssl.SSLProtocolException: Connection reset by peer (Write failed)
        at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:126)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:321)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
        at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:259)
        at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:988)
        at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
        at java.base/java.io.BufferedOutputStream.write(BufferedOutputStream.java:127)
        at java.base/java.io.FilterOutputStream.write(FilterOutputStream.java:108)
        at org.postgresql.core.PGStream.sendInteger4(PGStream.java:348)
        at org.postgresql.core.v3.QueryExecutorImpl.sendBind(QueryExecutorImpl.java:1725)
        at org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1968)
        at org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1488)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:348)
        ... 49 common frames omitted
Caused by: java.net.SocketException: Connection reset by peer (Write failed)
        at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
        at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
        at java.base/sun.security.ssl.SSLSocketOutputRecord.deliver(SSLSocketOutputRecord.java:320)
        at java.base/sun.security.ssl.SSLSocketImpl$AppOutputStream.write(SSLSocketImpl.java:983)
        ... 57 common frames omitted
2022.07.07 17:20:21 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process
2022.07.07 17:20:21 INFO  web[][o.s.s.n.NotificationDaemon] Notification service stopped
2022.07.07 17:20:22 WARN  web[][o.s.p.ProcessEntryPoint$HardStopperThread] Can not stop in 1000ms
2022.07.07 17:20:22 WARN  web[][o.s.s.a.EmbeddedTomcat] Failed to stop web server
org.apache.catalina.LifecycleException: Failed to stop component [StandardServer[-1]]
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:238)
        at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:437)
        at org.sonar.server.app.EmbeddedTomcat.terminate(EmbeddedTomcat.java:104)
        at org.sonar.server.app.WebServer.hardStop(WebServer.java:83)
        at org.sonar.process.ProcessEntryPoint$HardStopperThread.lambda$new$0(ProcessEntryPoint.java:219)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

Thanks.

Hi,

My answer is pretty much the same as it was two years ago: the problem is with talking to your database.

According to SO

This means that a TCP RST was received and the connection is now closed. This occurs when a packet is sent from your end of the connection but the other end does not recognize the connection; it will send back a packet with the RST bit set in order to forcibly close the connection.

This can happen if the other side crashes and then comes back up or if it calls close() on the socket while there is data from you in transit, and is an indication to you that some of the data that you previously sent may not have been received.

So again, look at the DB.

 
Ann