Hi,
We have installed elasticsearch as service in Ubuntu 16.0 64 bit (1 CPU, 6 GB RAM) and worked well with default configuration. after few days we felt the elasticsearch response was slow. so we were trying to change the -Xmx -Xms values from 1gb to 2gb but the service is not getting started with the error 'Cannot allocate memory'.
Note: This is not a single box for elastic search. Other few applications are also running in this instance.
Here the error in detail. Kindly suggest us for resolution. Thanks...
elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2019-04-11 17:39:06 IST; 1s ago
Docs: http://www.elastic.co
Process: 14283 ExecStart=/usr/share/elasticsearch/bin/elasticsearch -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=1/FAILURE)
Main PID: 14283 (code=exited, status=1/FAILURE)
Apr 11 17:39:04 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: warning: Falling back to java on path. This behavior is deprecated. Specify JAVA_HOME
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot alloca
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: #
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: # There is insufficient memory for the Java Runtime Environment to continue.
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: # Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: # An error report file with more information is saved as:
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in elasticsearch[14283]: # /var/log/elasticsearch/hs_err_pid14283.log
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in systemd[1]: elasticsearch.service: Main process exited, code=exited, status=1/FAILURE
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in systemd[1]: elasticsearch.service: Unit entered failed state.
Apr 11 17:39:06 e2e-53-13.e2enetworks.net.in systemd[1]: elasticsearch.service: Failed with result 'exit-code'.
===============================================================
Content of PID error log file:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 2060255232 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2749), pid=14283, tid=0x00007f8b2166b700
#
# JRE version: (8.0_201-b09) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.201-b09 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
--------------- T H R E A D ---------------
Current thread (0x00007f8b1800e000): JavaThread "Unknown thread" [_thread_in_vm, id=14345, stack(0x00007f8b2156b000,0x00007f8b2166c000)]
Stack: [0x00007f8b2156b000,0x00007f8b2166c000], sp=0x00007f8b2166a500, free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xad3525] VMError::report_and_die()+0x2e5
V [libjvm.so+0x4e0457] report_vm_out_of_memory(char const*, int, unsigned long, VMErrorType, char const*)+0x67
V [libjvm.so+0x9102f0] os::pd_commit_memory(char*, unsigned long, unsigned long, bool)+0x100
V [libjvm.so+0x90791f] os::commit_memory(char*, unsigned long, unsigned long, bool)+0x1f
V [libjvm.so+0xacf81c] VirtualSpace::initialize(ReservedSpace, unsigned long)+0x20c
V [libjvm.so+0x5ecd17] CardGeneration::CardGeneration(ReservedSpace, unsigned long, int, GenRemSet*)+0xc7
V [libjvm.so+0x4bd48e] ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(ReservedSpace, unsigned long, int, CardTableRS*, bool, FreeBlockDictionary<FreeChunk>::DictionaryChoice)+0x2e
V [libjvm.so+0x5ee0e2] GenerationSpec::init(ReservedSpace, int, GenRemSet*)+0x182
V [libjvm.so+0x5d91af] GenCollectedHeap::initialize()+0x20f
V [libjvm.so+0xa9714a] Universe::initialize_heap()+0x16a
V [libjvm.so+0xa97433] universe_init()+0x33
V [libjvm.so+0x631fd0] init_globals()+0x50
V [libjvm.so+0xa79b69] Threads::create_vm(JavaVMInitArgs*, bool*)+0x409
V [libjvm.so+0x6d7b4f] JNI_CreateJavaVM+0x4f
C [libjli.so+0x7ee4] JavaMain+0x84
C [libpthread.so.0+0x76ba] start_thread+0xca