Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly setting allocated memory in the ES_JAVA_OPTS variable #434

Closed
karmi opened this issue Feb 12, 2016 · 1 comment
Closed

Incorrectly setting allocated memory in the ES_JAVA_OPTS variable #434

karmi opened this issue Feb 12, 2016 · 1 comment
Assignees
Labels
Bug Something isn't working

Comments

@karmi
Copy link
Contributor

karmi commented Feb 12, 2016

I've got a report from a user using the Shield's addusers script, where the command fails because OS cannot allocate memory (see output below), presumably because the script tries to use the memory settings for Elasticsearch process, and there's no additional 8GB on the system :)

It seems like we're including new_resource.allocated_memory in the ES_JAVA_OPTS environment variable in the Chef code.

I'm wondering if we should do this? Shouldn't setting ES_HEAP_SIZE be enough?

================================================================================ 
Error executing action `run` on resource 'execute[add-esusers-XXX]' 
================================================================================ 

Mixlib::ShellOut::ShellCommandFailed 
------------------------------------ 
Expected process to exit with [0], but received '1' 
---- Begin output of /usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser ---- 
STDOUT: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x000000061a0c0000, 8065908736, 0) failed; error='Cannot allocate memory' (errno=12) 
# 
# There is insufficient memory for the Java Runtime Environment to continue. 
# Native memory allocation (malloc) failed to allocate 8065908736 bytes for committing reserved memory. 
# An error report file with more information is saved as: 
# /usr/share/elasticsearch/hs_err_pid14351.log 
STDERR: 
---- End output of /usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser ---- 
Ran /usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser returned 1 

Resource Declaration: 
--------------------- 
# In /var/chef/runs/e3e4b649-af5f-40bf-8afd-34b307229bb1/local-mode-cache/cache/cookbooks/esaas/recipes/elasticsearch.rb 

69: execute 'add-esusers-xeroadm' do 
70: command "/usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser" 
71: end 
72: 

Compiled Resource: 
------------------ 
# Declared in /var/chef/runs/e3e4b649-af5f-40bf-8afd-34b307229bb1/local-mode-cache/cache/cookbooks/esaas/recipes/elasticsearch.rb:69:in `from_file' 

execute("add-esusers-xeroadm") do 
action [:run] 
retries 0 
retry_delay 2 
default_guard_interpreter :execute 
command "/usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser" 
backup 5 
returns 0 
declared_type :execute 
cookbook_name "esaas" 
recipe_name "elasticsearch" 
end 

[2016-02-10T22:45:22+00:00] INFO: Running queued delayed notifications before re-raising exception 
[2016-02-10T22:45:22+00:00] ERROR: Running exception handlers 
[2016-02-10T22:45:22+00:00] ERROR: Exception handlers complete 
[2016-02-10T22:45:22+00:00] FATAL: Stacktrace dumped to /var/chef/runs/e3e4b649-af5f-40bf-8afd-34b307229bb1/local-mode-cache/cache/chef-stacktrace.out 
[2016-02-10T22:45:22+00:00] ERROR: execute[add-esusers-xeroadm] (esaas::elasticsearch line 69) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1' 
---- Begin output of /usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser ---- 
STDOUT: Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x000000061a0c0000, 8065908736, 0) failed; error='Cannot allocate memory' (errno=12) 
# 
# There is insufficient memory for the Java Runtime Environment to continue. 
# Native memory allocation (malloc) failed to allocate 8065908736 bytes for committing reserved memory. 
# An error report file with more information is saved as: 
# /usr/share/elasticsearch/hs_err_pid14351.log 
STDERR: 
---- End output of /usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser ---- 
Ran /usr/share/elasticsearch/bin/shield/esusers useradd xeroadm -p changeme -r poweruser returned 1 
[2016-02-10T22:45:23+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

CC/ @markwalkom

@karmi karmi added the Bug Something isn't working label Feb 12, 2016
@martinb3 martinb3 self-assigned this Feb 15, 2016
@martinb3
Copy link
Contributor

Removed allocated_memory from ES_JAVA_OPTS -- ES_HEAP_SIZE is enough, agreed! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants