When using the sonarqube:lts-community image and providing the following param
SONAR_CE_JAVAOPTS=-Xmx2G -Xms2G
On startup it wil crash with the following message.
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 44695552 bytes for committing reserved memory.
Complete log:
2023.01.20 07:16:34 INFO app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2023.01.20 07:16:34 INFO app[][o.s.a.es.EsSettings] Elasticsearch listening on [HTTP: 127.0.0.1:9001, TCP: 127.0.0.1:45121]
2023.01.20 07:16:34 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='es', ipcIndex=1, logFilenamePrefix=es]] from [/opt/sonarqube/elasticsearch]: /opt/sonarqube/elasticsearch/bin/elasticsearch
2023.01.20 07:16:35 INFO app[][o.s.a.SchedulerImpl] Waiting for Elasticsearch to be up and running
warning: no-jdk distributions that do not bundle a JDK are deprecated and will be removed in a future release
2023.01.20 07:16:49 INFO es[][o.e.n.Node] version[7.16.2], pid[30], build[default/tar/2b937c44140b6559905130a8650c64dbd0879cfb/2021-12-18T19:42:46.604893745Z], OS[Linux/4.14.35-linuxkit/amd64], JVM[Eclipse Adoptium/OpenJDK 64-Bit Server VM/11.0.13/11.0.13+8]
2023.01.20 07:16:49 INFO es[][o.e.n.Node] JVM home [/opt/java/openjdk]
2023.01.20 07:16:49 INFO es[][o.e.n.Node] JVM arguments [-XX:+UseG1GC, -Djava.io.tmpdir=/opt/sonarqube/temp, -XX:ErrorFile=../logs/es_hs_err_pid%p.log, -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=/opt/sonarqube/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, -Xmx512m, -Xms512m, -XX:MaxDirectMemorySize=256m, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/opt/sonarqube/elasticsearch, -Des.path.conf=/opt/sonarqube/temp/conf/es, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=false]
2023.01.20 07:16:50 INFO es[][o.e.p.PluginsService] loaded module [analysis-common]
2023.01.20 07:16:50 INFO es[][o.e.p.PluginsService] loaded module [lang-painless]
2023.01.20 07:16:50 INFO es[][o.e.p.PluginsService] loaded module [parent-join]
2023.01.20 07:16:50 INFO es[][o.e.p.PluginsService] loaded module [reindex]
2023.01.20 07:16:50 INFO es[][o.e.p.PluginsService] loaded module [transport-netty4]
2023.01.20 07:16:50 INFO es[][o.e.p.PluginsService] no plugins loaded
2023.01.20 07:16:50 INFO es[][o.e.e.NodeEnvironment] using [1] data paths, mounts [[/ (overlay)]], net usable_space [18.6gb], net total_space [19.6gb], types [overlay]
2023.01.20 07:16:50 INFO es[][o.e.e.NodeEnvironment] heap size [512mb], compressed ordinary object pointers [true]
2023.01.20 07:16:50 INFO es[][o.e.n.Node] node name [sonarqube], node ID [oDgb2fn1Rzyb2S5ks4bOOA], cluster name [sonarqube], roles [data_frozen, master, remote_cluster_client, data, data_content, data_hot, data_warm, data_cold, ingest]
2023.01.20 07:16:57 INFO es[][o.e.t.NettyAllocator] creating NettyAllocator with the following configs: [name=unpooled, suggested_max_allocation_size=256kb, factors={es.unsafe.use_unpooled_allocator=null, g1gc_enabled=true, g1gc_region_size=1mb, heap_size=512mb}]
2023.01.20 07:16:57 INFO es[][o.e.d.DiscoveryModule] using discovery type [zen] and seed hosts providers [settings]
2023.01.20 07:16:58 INFO es[][o.e.g.DanglingIndicesState] gateway.auto_import_dangling_indices is disabled, dangling indices will not be automatically detected or imported and must be managed manually
2023.01.20 07:16:58 INFO es[][o.e.n.Node] initialized
2023.01.20 07:16:58 INFO es[][o.e.n.Node] starting ...
2023.01.20 07:16:58 INFO es[][o.e.t.TransportService] publish_address {127.0.0.1:45121}, bound_addresses {127.0.0.1:45121}
2023.01.20 07:16:59 WARN es[][o.e.b.BootstrapChecks] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
2023.01.20 07:16:59 WARN es[][o.e.b.BootstrapChecks] max number of threads [3766] for user [sonarqube] is too low, increase to at least [4096]
2023.01.20 07:16:59 WARN es[][o.e.b.BootstrapChecks] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
2023.01.20 07:16:59 INFO es[][o.e.c.c.Coordinator] setting initial configuration to VotingConfiguration{oDgb2fn1Rzyb2S5ks4bOOA}
2023.01.20 07:16:59 INFO es[][o.e.c.s.MasterService] elected-as-master ([1] nodes joined)[{sonarqube}{oDgb2fn1Rzyb2S5ks4bOOA}{LWzERsuQRQCzSLoZSIZklQ}{127.0.0.1}{127.0.0.1:45121}{cdfhimrsw} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, delta: master node changed {previous [], current [{sonarqube}{oDgb2fn1Rzyb2S5ks4bOOA}{LWzERsuQRQCzSLoZSIZklQ}{127.0.0.1}{127.0.0.1:45121}{cdfhimrsw}]}
2023.01.20 07:16:59 INFO es[][o.e.c.c.CoordinationState] cluster UUID set to [1mwJCcwsR3umnb6TSLrmDA]
2023.01.20 07:16:59 INFO es[][o.e.c.s.ClusterApplierService] master node changed {previous [], current [{sonarqube}{oDgb2fn1Rzyb2S5ks4bOOA}{LWzERsuQRQCzSLoZSIZklQ}{127.0.0.1}{127.0.0.1:45121}{cdfhimrsw}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
2023.01.20 07:17:00 INFO es[][o.e.h.AbstractHttpServerTransport] publish_address {127.0.0.1:9001}, bound_addresses {127.0.0.1:9001}
2023.01.20 07:17:00 INFO es[][o.e.n.Node] started
2023.01.20 07:17:00 INFO es[][o.e.g.GatewayService] recovered [0] indices into cluster_state
2023.01.20 07:17:00 INFO app[][o.s.a.SchedulerImpl] Process[es] is up
2023.01.20 07:17:00 INFO app[][o.s.a.ProcessLauncherImpl] Launch process[[key='web', ipcIndex=2, logFilenamePrefix=web]] from [/opt/sonarqube]: /opt/java/openjdk/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 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Dhttp.nonProxyHosts=localhost|127.*|[::1] -cp ./lib/sonar-application-8.9.10.61524.jar:/opt/sonarqube/lib/jdbc/h2/h2-1.4.199.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process3013101868762699231properties
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e0000000, 44695552, 0) failed; error='Not enough space' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 44695552 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /opt/sonarqube/hs_err_pid105.log
2023.01.20 07:17:01 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [web]: 1
2023.01.20 07:17:01 INFO app[][o.s.a.SchedulerImpl] Process[web] is stopped
2023.01.20 07:17:01 WARN app[][o.s.a.p.AbstractManagedProcess] Process exited with exit value [es]: 143
2023.01.20 07:17:01 INFO app[][o.s.a.SchedulerImpl] Process[es] is stopped
2023.01.20 07:17:01 INFO app[][o.s.a.SchedulerImpl] SonarQube is stopped
Can someone help me out to fix this problem?