Getting Elastic Error , Sonar Server is Stopping

version

  • sonarqube-10.4.1.88267 version
    java version “17.0.8” 2023-07-18 LTS
    Java™ SE Runtime Environment (build 17.0.8+9-LTS-211)
    Java HotSpot™ 64-Bit Server VM (build 17.0.8+9-LTS-211, mixed mode, sharing)

I have run this in the command prompt
C:\sonarqube-10.4.1.88267\bin\windows-x86-64>StartSonar.bat

I’m unable to run the Sonar Server.

type or paC:\sonarqube-10.4.1.88267\bin\windows-x86-64>StartSonar.bat
Starting SonarQube...
2024.03.20 12:49:11 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory C:\sonarqube-10.4.1.88267\temp
2024.03.20 12:49:11 INFO  app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:54245]
2024.03.20 12:49:11 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[ELASTICSEARCH] from [C:\sonarqube-10.4.1.88267\elasticsearch]: C:\Program Files\Java\jdk-17\bin\java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=./bin/elasticsearch -Dcli.libs=lib/tools/server-cli -Des.path.home=C:\sonarqube-10.4.1.88267\elasticsearch -Des.path.conf=C:\sonarqube-10.4.1.88267\temp\conf\es -Des.distribution.type=tar -cp C:\sonarqube-10.4.1.88267\elasticsearch\lib\*;C:\sonarqube-10.4.1.88267\elasticsearch\lib\cli-launcher\* org.elasticsearch.launcher.CliToolLauncher
2024.03.20 12:49:11 INFO  app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
2024.03.20 12:49:12 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2024.03.20 12:49:12 INFO  app[][o.s.a.ProcessLauncherImpl] Launch process[WEB_SERVER] from [C:\sonarqube-10.4.1.88267]: C:\Program Files\Java\jdk-17\bin\java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Djava.io.tmpdir=C:\sonarqube-10.4.1.88267\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.4.1.88267.jar;C:\sonarqube-10.4.1.88267\lib\jdbc\h2\h2-2.2.224.jar org.sonar.server.app.WebServer C:\sonarqube-10.4.1.88267\temp\sq-process11374774871296192455properties
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.sonar.process.PluginSecurityManager (file:/C:/sonarqube-10.4.1.88267/lib/sonar-application-10.4.1.88267.jar)
WARNING: Please consider reporting this to the maintainers of org.sonar.process.PluginSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
ERROR: Elasticsearch did not exit normally - check the logs at C:\sonarqube-10.4.1.88267\logs\sonarqube.log

ERROR: Elasticsearch exited unexpectedly, with exit code 1
2024.03.20 12:49:26 WARN  app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [ElasticSearch]: 1
2024.03.20 12:49:26 INFO  app[][o.s.a.SchedulerImpl] Process[ElasticSearch] is stopped
2024.03.20 12:49:30 INFO  app[][o.s.a.SchedulerImpl] Process[Web Server] is stopped
2024.03.20 12:49:30 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stoppedste code here

This is th es.log file

2024.03.20 12:49:19 INFO  es[][o.e.n.Node] version[8.11.0], pid[304], build[tar/d9ec3fa628c7b0ba3d25692e277ba26814820b20/2023-11-04T10:04:57.184859352Z], OS[Windows 11/10.0/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/17.0.8/17.0.8+9-LTS-211]
2024.03.20 12:49:19 INFO  es[][o.e.n.Node] JVM home [C:\Program Files\Java\jdk-17], using bundled JDK [false]
2024.03.20 12:49:19 INFO  es[][o.e.n.Node] JVM arguments [-Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -Djava.security.manager=allow, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=SPI,COMPAT, --add-opens=java.base/java.io=org.elasticsearch.preallocate, -XX:+UseG1GC, -Djava.io.tmpdir=C:\sonarqube-10.4.1.88267\temp, -XX:ErrorFile=C:\sonarqube-10.4.1.88267\logs\es_hs_err_pid%p.log, -Xlog:disable, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djna.tmpdir=C:\sonarqube-10.4.1.88267\temp, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dio.netty.allocator.numDirectArenas=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j2.formatMsgNoLookups=true, -Djava.locale.providers=COMPAT, -Dcom.redhat.fips=false, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -XX:G1HeapRegionSize=4m, -XX:InitiatingHeapOccupancyPercent=30, -XX:G1ReservePercent=15, -Des.distribution.type=tar, --module-path=C:\sonarqube-10.4.1.88267\elasticsearch\lib, --add-modules=jdk.net, --add-modules=ALL-MODULE-PATH, -Djdk.module.main=org.elasticsearch.server]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [lang-painless]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-core]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [old-lucene-versions]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [parent-join]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [rest-root]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [reindex]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-redact]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [analysis-common]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [x-pack-security]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [transport-netty4]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [aggregations]
2024.03.20 12:49:21 INFO  es[][o.e.p.PluginsService] loaded module [apm]
2024.03.20 12:49:26 ERROR es[][o.e.b.Elasticsearch] fatal exception while booting Elasticsearch
java.lang.IllegalStateException: failed to obtain node locks, tried [C:\sonarqube-10.4.1.88267\data\es8]; maybe these locations are not writable or multiple nodes were started on the same data path?
	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:294) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.node.Node.<init>(Node.java:499) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.node.Node.<init>(Node.java:344) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch$2.<init>(Elasticsearch.java:236) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.initPhase3(Elasticsearch.java:236) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73) ~[elasticsearch-8.11.0.jar:?]
Caused by: org.apache.lucene.store.LockObtainFailedException: Lock held by another program: C:\sonarqube-10.4.1.88267\data\es8\node.lock
	at org.apache.lucene.store.NativeFSLockFactory.obtainFSLock(NativeFSLockFactory.java:117) ~[lucene-core-9.8.0.jar:?]
	at org.apache.lucene.store.FSLockFactory.obtainLock(FSLockFactory.java:43) ~[lucene-core-9.8.0.jar:?]
	at org.apache.lucene.store.BaseDirectory.obtainLock(BaseDirectory.java:44) ~[lucene-core-9.8.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:232) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment$NodeLock.<init>(NodeEnvironment.java:206) ~[elasticsearch-8.11.0.jar:?]
	at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:286) ~[elasticsearch-8.11.0.jar:?]
	... 5 more

Can someone help with this

Hi,

Welcome to the community!

Here’s the problem:

So either you’ve got a zombie process from a previous launch attempt still holding the lock, or something “helpful” on your machine (e.g. Windows Defender…?) has grabbed the lock.

 
HTH,
Ann