{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/puppet-elasticsearch/issues/589","repository_url":"https://api.github.com/repos/elastic/puppet-elasticsearch","labels_url":"https://api.github.com/repos/elastic/puppet-elasticsearch/issues/589/labels{/name}","comments_url":"https://api.github.com/repos/elastic/puppet-elasticsearch/issues/589/comments","events_url":"https://api.github.com/repos/elastic/puppet-elasticsearch/issues/589/events","html_url":"https://github.com/elastic/puppet-elasticsearch/issues/589","id":136233999,"number":589,"title":"Custom ES_MIN_MEM and ES_MAX_MEM values not propagating properly","user":{"login":"bhuto","id":597493,"avatar_url":"https://avatars.githubusercontent.com/u/597493?v=3","gravatar_id":"","url":"https://api.github.com/users/bhuto","html_url":"https://github.com/bhuto","followers_url":"https://api.github.com/users/bhuto/followers","following_url":"https://api.github.com/users/bhuto/following{/other_user}","gists_url":"https://api.github.com/users/bhuto/gists{/gist_id}","starred_url":"https://api.github.com/users/bhuto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhuto/subscriptions","organizations_url":"https://api.github.com/users/bhuto/orgs","repos_url":"https://api.github.com/users/bhuto/repos","events_url":"https://api.github.com/users/bhuto/events{/privacy}","received_events_url":"https://api.github.com/users/bhuto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-25T00:24:40Z","updated_at":"2016-02-25T08:42:18Z","closed_at":null,"body":"I am testing this module using a CentOS 6 Vagrant box and in my hiera file I have the following code:\r\n```\r\nelasticsearch::instances:\r\n  master:\r\n    config: \r\n      node.name: \"%{hostname}-master\"\r\n      node.master: true\r\n      node.data: false\r\n      http.port: 29200\r\n      transport.tcp.port: 29300\r\n      discovery.zen.ping.multicast.enabled: false\r\n    init_defaults:\r\n      'ES_MIN_MEM': '512m'\r\n      'ES_MAX_MEM': '512m'\r\n```\r\nThis leads to the following default file for the 'master' instance, as expected:\r\n```\r\n[vagrant@vagrant-centos-6 ~]$ cat /etc/sysconfig/elasticsearch-master\r\nCONF_DIR=/etc/elasticsearch/master\r\nCONF_FILE=/etc/elasticsearch/master/elasticsearch.yml\r\nES_GROUP=elasticsearch\r\nES_HOME=/usr/share/elasticsearch\r\nES_USER=elasticsearch\r\nLOG_DIR=/var/log/elasticsearch/master\r\nMAX_OPEN_FILES=65535\r\nES_MAX_MEM=512m\r\nES_MIN_MEM=512m\r\n```\r\nHowever, on starting the service using `sudo /etc/init.d/elasticsearch-master start`, it starts with the default  '256m' and '1g' values.\r\n```\r\n[vagrant@vagrant-centos-6 ~]$ ps aux| grep elasticsearch\r\n497      19652 84.2  5.2 3139944 206844 ?      Sl   00:15   0:03 /usr/bin/java -Xms256m -Xmx1g -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC -Dfile.encoding=UTF-8 -Djna.nosys=true -Des.path.home=/usr/share/elasticsearch -cp /usr/share/elasticsearch/lib/elasticsearch-2.1.1.jar:/usr/share/elasticsearch/lib/* org.elasticsearch.bootstrap.Elasticsearch start -p /var/run/elasticsearch/elasticsearch-master.pid -d -Des.default.path.home=/usr/share/elasticsearch -Des.default.path.logs=/var/log/elasticsearch/master -Des.default.path.data= -Des.default.path.work= -Des.default.path.conf=/etc/elasticsearch/master\r\nvagrant  19669  0.0  0.0 103244   860 pts/0    S+   00:15   0:00 grep elasticsearch\r\n```\r\nMy understanding is that this is because the script in /etc/init.d/ (created via the corresponding template file) does not export the ES_MIN_MEM and ES_MAX_MEM variables, like it does for some other variables like ES_HEAP_SIZE and ES_HEAP_NEWSIZE, after it calls the defaults script (https://github.com/elastic/puppet-elasticsearch/blob/master/templates/etc/init.d/elasticsearch.RedHat.erb#L38). This causes the `/user/share/elasticsearch/bin/elasticsearch.in.sh` script to infer that the variable is not set and it ends up using the default values. Making a change to the init file template by adding export directives for those two variables seems to make it work. Two questions then:\r\n\r\n1. Is this a correct assessment and thus a bug?\r\n2. Does the simple fix suggested above solve things or are there potential issues there?\r\n"},"comment":{"url":"https://api.github.com/repos/elastic/puppet-elasticsearch/issues/comments/188671645","html_url":"https://github.com/elastic/puppet-elasticsearch/issues/589#issuecomment-188671645","issue_url":"https://api.github.com/repos/elastic/puppet-elasticsearch/issues/589","id":188671645,"user":{"login":"electrical","id":271677,"avatar_url":"https://avatars.githubusercontent.com/u/271677?v=3","gravatar_id":"","url":"https://api.github.com/users/electrical","html_url":"https://github.com/electrical","followers_url":"https://api.github.com/users/electrical/followers","following_url":"https://api.github.com/users/electrical/following{/other_user}","gists_url":"https://api.github.com/users/electrical/gists{/gist_id}","starred_url":"https://api.github.com/users/electrical/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electrical/subscriptions","organizations_url":"https://api.github.com/users/electrical/orgs","repos_url":"https://api.github.com/users/electrical/repos","events_url":"https://api.github.com/users/electrical/events{/privacy}","received_events_url":"https://api.github.com/users/electrical/received_events","type":"User","site_admin":false},"created_at":"2016-02-25T08:42:18Z","updated_at":"2016-02-25T08:42:18Z","body":"Hi,\r\n\r\nBest to use ES_HEAP_SIZE which should work fine, you don't need to use any of the other memory related settings."}}