Post-upgrade issues: 6.4.2 ES heap running away (6.5.0 too)


Another dump:

ElasticSearch timeouts after upgrade to 6.5.1
ElasticSearch timeouts after upgrade to 6.5.1
(David Turner) #25

A heap dump can be assumed to contain everything in memory in the Elasticsearch process, so if Elasticsearch has access to personal/private data then yes.

(David Turner) #26

I think I've found something, but I think it only explains this situation if you're creating a lot of new indices (and possibly deleting them again) or if the shards in your cluster are moving around a lot. Does that sound like your cluster?


@DavidTurner I think it depends on the scale?

i have nightly curator jobs that compacts/snapshots/deletes indices daily, and then a lot of new daily indices are created.

I would say, daily turnover is, say, 15 indices per day. So, every night when the time rolls over, curator snapshots to s3, and deletes 15 indices, and 15 new indices are created.

This worked without any issues on 6.2.3 (as per my original report), and only started running away, on master node only (non-master master-eligible node is fine), after upgrade to 6.4.2. since then ive updated to 6.4.3 and now to 6.5.0 asap.

the stack is primarily for monitoring with elk + beats + grafana and a few open source scripts. My one thought was that you guys are caching credentials somehow, because i had this thing running and maybe because of frequency of re-authing it was causing that object space to run away, but i turned that off the other day, as well as cerebro manager as well, but the issue persists.

i have disabled all 3rd party tools for monitoring the cluster, besides grafana as i would imagine its not the cause, but again, i am no expert here so maybe its worth checking as well, and enabled native monitoring that comes with basic license and set collection interval to 30s.

edit: about 70% of all log flow goes through logstash, but we have some kubernetes logs from filebeat/metricbeat that go directly to ES. again, not sure of the relevance here.

edit 2: to elabote on my thought process a little more, it seems between 6.2.3 and 6.4.x due to the basic license opening, the cluster stats moved under that space. we have some containerized clusters using 6.2.3 right now which are being monitored by that same python script which are running fine, but in that version cluster stats were not behind the wall. i had tried to disable basic license entirely during the test, but did nto finish it as it killed all access to metrics via web requests.


also, given what you mentioned (and i looked up in the interim), im afraid i cannot expose the dump publicly.

(David Turner) #29

Ok 15 indices per day is not a lot at all.

I ask about this because if I understand your screenshot correctly the heap dump has 358,000+ instances of things like IndexSettings and IndexMetaData, which are created (once) when the first shard of an index is allocated to a node. They should be cleaned up when the last shard of that index is deallocated, but even if they weren't I can't see how Elasticsearch would ever perform hundreds of thousands of shard allocations like this.

EDIT this is wrong and I corrected it here


Okay, let me get a more updated dump. These dumps are a few weeks old, and I have since updated ES, updated java, and other stuff.

I will follow up.

(David Turner) #31

I forgot to link the issue I opened:

This would explain a little difference in behaviour between 6.2 (without X-pack) and 6.4, which could be amplified by the creation of hundreds of thousands of indices, but at 15 new indices per day it doesn't explain what we're seeing here.


Meanwhile, is there a particular view/report you would find more helpful? I apologize, this was my very first time cracking a heap dump open, so I am still learning what most of the stuff even means. If you could give me a little guidance as to what to look for, what reports, sorts, or tables to generate, i would be much obliged.


Another thing to note, the OOM takes about, 4 hours to achieve. This can happen during the day without any indices created or deleted in the interim.

(David Turner) #34

I'm sorry, what I said here is wrong. We also create new instances of these things when the index settings or metadata are updated. Perhaps this is happening a lot?

If you grab some fresher heap dumps and they show the same pattern then I would look into some of those instances further: is the String name of the index in question - perhaps this'll tell us something?


Okay, I will get one when it gets close to the death point. Should be a few hours.

Meanwhile, are there any queries I can run that would expose some of the metadata updates?

I am tailing the log flow for both nodes, but i do not see anything really happening, aside from an occasional date parsing error (i doubt its at all relevant).

would metricbeat or filebeat agent that has
setup.template.enabled: true
trigger this? even if the net delta is zero?

(David Turner) #36

Could you try setting DEBUG? You can enable this dynamically:

PUT /_cluster/settings
  "persistent": {
    "": "DEBUG"

I think this logs something every time we create an, of which your heap dump contains too many, so this may be illuminating.

You can disable this again by setting it to null:

PUT /_cluster/settings
  "persistent": {
    "": null


Apologies for prolonged absence, priorities shifted a little bit. I still plan on getting that info for you.

(David Turner) #38

Thanks @hollowimage. Just so you know, #36308 should fix the leak that we suspected to contribute to your issue, and this has been merged so should be released in 6.5.3 (the next patch release).

(David Turner) #39

6.5.3 is now released, so the best next step is probably to upgrade and see if it helps.


I will as soon as it makes it over into the yum repo. Thanks @DavidTurner Ill let you know if that resolves the issue.


It seems the issue is now resolved. Cluster has been stable for about 18 hours, and heap is no longer running away. Ill keep an eye on it for a few days/weeks and will follow up one more time with findings, once i release a lot of my super aggressive curator policies and the data volume on the cluster incrases.

(Len Rugen) #42

I'm curious, how much data to you have on disk? I saw 28G above, so 14G per node?


(system) #43

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.