SonarQube install: Process exited with exit value [ElasticSearch]: 143

I’m trying to install SonarQube 10.0.0 on Amazon Linux 2023 AMI but I can’t figure out what’s going wrong. I’ve checked the whole documentation and didn’t find any answer.

I’ve installed OpenJDK 17.0.7 using java-17-amazon-corretto and Postgres 15 on which I have a sonaruser with its sonardb database.

In my /opt/sonarqube/conf/sonar.properties file, I have these settings:

sonar.jdbc.username=sonaruser
sonar.jdbc.password=S0n1RQu83Psql
sonar.jdbc.url=jdbc:postgresql://localhost:5432/sonardb
sonar.web.host=192.168.0.1
sonar.web.context=/sonarqube

And, I’ve these system variables:

sysctl vm.max_map_count = 524288
fs.file-max = 9223372036854775807
ulimit -n = 131072
ulimit -u = 8192

When I start SonarQube, after a few seconds it stops running.

My es.log seems to be ok:

2023.06.06 16:21:34 INFO  es[][o.e.n.Node] initialized
2023.06.06 16:21:34 INFO  es[][o.e.n.Node] starting ...
2023.06.06 16:21:35 INFO  es[][o.e.t.TransportService] publish_address {127.0.0.1:37723}, bound_addresses {127.0.0.1:37723}
2023.06.06 16:21:35 INFO  es[][o.e.b.BootstrapChecks] explicitly enforcing bootstrap checks
2023.06.06 16:21:35 WARN  es[][o.e.c.c.ClusterBootstrapService] this node is locked into cluster UUID [0pTAY-OsQBWTK7m1pzvL3g] but [cluster.initial_master_nodes] is set to [sonarqube]; remove this setting to avoid possible data loss caused by subsequent cluster bootstrap attempts
2023.06.06 16:21:35 INFO  es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[_FINISH_ELECTION_, {sonarqube}{OjqvMlQ1SSynYUkv2AVvww}{fmScGzAQR7ymRVkmt4CFtQ}{sonarqube}{127.0.0.1}{127.0.0.1:37723}{cdfhilmrstw} completing election], term: 7, version: 26, delta: master node changed {previous [], current [{sonarqube}{OjqvMlQ1SSynYUkv2AVvww}{fmScGzAQR7ymRVkmt4CFtQ}{sonarqube}{127.0.0.1}{127.0.0.1:37723}{cdfhilmrstw}]}
2023.06.06 16:21:35 INFO  es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{OjqvMlQ1SSynYUkv2AVvww}{fmScGzAQR7ymRVkmt4CFtQ}{sonarqube}{127.0.0.1}{127.0.0.1:37723}{cdfhilmrstw}]}, term: 7, version: 26, reason: Publication{term=7, version=26}
2023.06.06 16:21:35 INFO  es[][o.e.r.s.FileSettingsService] starting file settings watcher ...
2023.06.06 16:21:35 INFO  es[][o.e.r.s.FileSettingsService] file settings service up and running [tid=29]
2023.06.06 16:21:35 INFO  es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2023.06.06 16:21:35 INFO  es[][o.e.n.Node] started {sonarqube}{OjqvMlQ1SSynYUkv2AVvww}{fmScGzAQR7ymRVkmt4CFtQ}{sonarqube}{127.0.0.1}{127.0.0.1:37723}{cdfhilmrstw}{rack_id=sonarqube, xpack.installed=true}
2023.06.06 16:21:36 INFO  es[][o.e.l.LicenseService] license [445b09bb-ae4f-4f55-94e4-8db27687cbb6] mode [basic] - valid
2023.06.06 16:21:36 INFO  es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2023.06.06 16:21:37 INFO  es[][o.e.h.n.s.HealthNodeTaskExecutor] Node [{sonarqube}{OjqvMlQ1SSynYUkv2AVvww}] is selected as the current health node.
2023.06.06 16:21:41 INFO  es[][o.e.n.Node] stopping ...
2023.06.06 16:21:41 INFO  es[][o.e.r.s.FileSettingsService] shutting down watcher thread
2023.06.06 16:21:41 INFO  es[][o.e.r.s.FileSettingsService] watcher service stopped
2023.06.06 16:21:41 INFO  es[][o.e.n.Node] stopped
2023.06.06 16:21:41 INFO  es[][o.e.n.Node] closing ...
2023.06.06 16:21:41 INFO  es[][o.e.n.Node] closed

My sonar.log is raising an error 143 without much information:

2023.06.06 16:21:21 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2023.06.06 16:21:21 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:37723]
2023.06.06 16:21:21 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [/opt/sonarqube/elasticsearch]: /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=/opt/sonarqube/elasticsearch -Des.path.conf=/opt/sonarqube/temp/conf/es -Des.distribution.type=tar -cp /opt/sonarqube/elasticsearch/lib/*:/opt/sonarqube/elasticsearch/lib/cli-launcher/* org.elasticsearch.launcher.CliToolLauncher
2023.06.06 16:21:21 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2023.06.06 16:21:36 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2023.06.06 16:21:36 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [/opt/sonarqube]: /usr/lib/jvm/java-17-amazon-corretto.x86_64/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=/opt/sonarqube/temp -XX:-OmitStackTraceInFastThrow --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 --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.management/sun.management=ALL-UNNAMED --add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED -Dcom.redhat.fips=false -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-10.0.0.68432.jar:/opt/sonarqube/lib/jdbc/postgresql/postgresql-42.5.1.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process12568009654237231697properties
2023.06.06 16:21:41 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2023.06.06 16:21:41 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 143
2023.06.06 16:21:41 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2023.06.06 16:21:41 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped

And my web.log provides me two errors

2023.06.06 14:46:52 INFO  web[][o.s.p.ProcessEntryPoint] Starting Web Server
2023.06.06 14:46:53 ERROR web[][o.s.s.a.EmbeddedTomcat] Fail to start web server
org.apache.catalina.LifecycleException: Protocol handler initialization failed
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:1050)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:554)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1045)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:136)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:173)
	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:486)
	at org.sonar.server.app.EmbeddedTomcat.start(EmbeddedTomcat.java:72)
	at org.sonar.server.app.WebServer.start(WebServer.java:55)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:97)
	at org.sonar.process.ProcessEntryPoint.launch(ProcessEntryPoint.java:81)
	at org.sonar.server.app.WebServer.main(WebServer.java:104)
Caused by: java.net.BindException: Permission denied
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:555)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
	at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:275)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:230)
	at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1227)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1240)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:604)
	at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:76)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:1047)
	... 12 common frames omitted

and

Caused by: java.lang.IllegalStateException: Failed to create table schema_migrations
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.start(MigrationHistoryTableImpl.java:48)
	at org.sonar.core.platform.StartableBeanPostProcessor.postProcessBeforeInitialization(StartableBeanPostProcessor.java:33)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:440)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
	... 44 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: no schema has been selected to create in
  Position: 14
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2676)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2366)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:356)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:496)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:413)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:333)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:319)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:295)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:290)
	at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:94)
	at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.execute(MigrationHistoryTableImpl.java:71)
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.createTable(MigrationHistoryTableImpl.java:59)
	at org.sonar.server.platform.db.migration.history.MigrationHistoryTableImpl.start(MigrationHistoryTableImpl.java:45)
	... 48 common frames omitted
2023.06.06 16:21:41 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown initiated...
2023.06.06 16:21:41 INFO  web[][c.z.h.HikariDataSource] HikariPool-1 - Shutdown completed.
2023.06.06 16:21:41 WARN  web[][o.a.c.l.WebappClassLoaderBase] The web application [ROOT] appears to have started a thread named [HikariPool-1 connection closer] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
2023.06.06 16:21:41 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2023.06.06 16:21:41 INFO  web[][o.s.p.ProcessEntryPoint] Hard stopping process

Do you have any insight on what could be going wrong?

Hi,

SonarQube runs three processes and each one checks on the others to make sure everything is up and that they should each still stay up. That’s what you’re seeing in es.log. It was fine but one of the others was down, so it shut down too.

The error in web.log is what to focus on (for startup problems, the problem shows up is in web.log 99% of the time).

As you say, you have two different errors. I would start with the DB error. SonarQube needs full CRUD access to its schema. At a guess, some permissions are missing.

Once you’ve worked through that, then you can move on to the bind error. This is going to be at the OS level. Did you change SonarQube’s ports? Perhaps you’ve simply picked too low a number?

 
Ann

Hi Ann,

As you said, it seems to be a Postgres issue as changing this line to use postgres superuser worked:
sonar.jdbc.username=postgres.
But I still have no clue why it doesn’t work for my custom sonaruser. At least I know where to search.

Thank you for your answer and help!

1 Like

Hi community i solved this problem
This Error comes when I was updating version sonar-9.6 to 10.3
step 1. run this command to check your all logs & error
–>sudo -Hu sonarh2s /opt/sonarqube/bin/linux-x86-64/sonar.sh console

step 2. make sure you have java version is 17 or you can check prerequisites here Prerequisites and overview

step 3. check your database credential configuration ‘or’ create new user and their database using below command

use command for create user

–>createuser sonar

login psql cli

–>psql

set credential for user

–>ALTER USER sonar WITH ENCRYPTED password ‘sonar’;

create database

–>CREATE DATABASE sonardb OWNER sonar;

assign user permission to database

–>GRANT ALL PRIVILEGES ON DATABASE sonardb TO sonar;

step 4. Edit this file like this
–>sudo nano /opt/sonarqube/conf/sonar.properties
sonar.jdbc.username=sonar
sonar.jdbc.password=sonar
sonar.jdbc.url=jdbc:postgresql://localhost/
sonardbsonar.web.javaAdditionalOpts=-server

step 6. reload and restart all service also reboot system

problem solved!

1 Like