SonarQube not starting on Linux

From few days, we are not able to start sonarqube.

Sonar version 8.1.0.31237
When, we check sonar log, getting heapdumpoutofmemory.

2021.06.28 16:38:17 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonar/sonarqube-8.1.0.31237]: /usr/lib/jvm/java-11-openjdk-11.0.3.7-1.el7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonar/sonarqube-8.1.0.31237/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx1G -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonar/sonarqube-8.1.0.31237/lib/jdbc/mssql/mssql-jdbc-7.2.2.jre11.jar org.sonar.server.app.WebServer /opt/sonar/sonarqube-8.1.0.31237/temp/sq-process6069645386915135309properties
2021.06.28 16:38:21 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
2021.06.28 16:38:22 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2021.06.28 16:38:22 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2021.06.28 16:38:22 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

Also in web.log

2021.06.28 16:38:18 INFO web[o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2021.06.28 16:38:19 INFO web[o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2021.06.28 16:38:19 INFO web[o.s.s.p.LogServerVersion] SonarQube Server / 8.1.0.31237 / 492562ade8941108d7bd281ea9c1cebcf0c1fce3
2021.06.28 16:38:19 INFO web[o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://10.168.2.141:1433;databaseName=sonar
2021.06.28 16:38:20 INFO web[o.s.s.p.ServerFileSystemImpl] SonarQube home: /opt/sonar/sonarqube-8.1.0.31237
2021.06.28 16:38:20 INFO web[o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2021.06.28 16:38:20 ERROR web[o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Failed to read content of table schema_migrations

    at java.base/java.lang.Thread.run(Thread.java:834)

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The SELECT permission was denied on the object ‘schema_migrations’, database ‘sonar’, schema ‘dbo’.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:262)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1621)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.doExecuteStatement(SQLServerStatement.java:868)
at com.microsoft.sqlserver.jdbc.SQLServerStatement$StmtExecCmd.doExecute(SQLServerStatement.java:768)

There is no change in database

Hi @Rohitkul ,

where do you get the heapdumpoutofmemory exception? i can not see it in the logs you provided.

what i can see in the log is this line

you already state that there was no change to the database, but this is a direct message that there is a permission problem on the database? please double check this

Hi Tobias,

The heapdumpoutofmemory exception came in sonar.log

2021.06.28 20:59:14 INFO app[o.s.a.ProcessLauncherImpl] Launch process[[key=‘web’, ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonar/sonarqube-8.1.0.31237]: /usr/lib/jvm/java-11-openjdk-11.0.3.7-1.el7.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonar/sonarqube-8.1.0.31237/temp --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED -Xmx1G -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.|[::1] -cp ./lib/common/:/opt/sonar/sonarqube-8.1.0.31237/lib/jdbc/mssql/mssql-jdbc-7.2.2.jre11.jar org.sonar.server.app.WebServer /opt/sonar/sonarqube-8.1.0.31237/temp/sq-process2533286819527868172properties
2021.06.28 20:59:19 INFO app[o.s.a.SchedulerImpl] Process[web] is stopped
2021.06.28 20:59:19 WARN app[o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2021.06.28 20:59:19 INFO app[o.s.a.SchedulerImpl] Process[es] is stopped
2021.06.28 20:59:19 INFO app[o.s.a.SchedulerImpl] SonarQube is stopped

In web.log

2021.06.29 09:24:26 INFO web[o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2021.06.29 09:24:26 ERROR web[o.s.s.p.PlatformImpl] Web server startup failed
java.lang.IllegalStateException: Failed to read content of table schema_migrations

I’m able to login to database with same credential mentioned in sonar.properties.

Adding sonar.properties.

sonar.jdbc.username=sonaradmin
sonar.jdbc.password=*************************

sonar.jdbc.url=jdbc:sqlserver://sonarqube;databaseName=sonar

There is no change on database or sonar.properties file. It was working earlier,

Hey @Rohitkul ,

i can not see any heapdumpoutofmemory from the logs you provided. can you highlight what you mean?

logging in does not seem to be the problem. the sonaradmin is not allowed to read from schema_migrations in the database sonar