Skip to content

[o.e.b.ElasticsearchUncaughtExceptionHandler] [node01-es-dev] fatal error in thread [elasticsearch[node01-es-dev][search][T#6]], exiting java.lang.OutOfMemoryError: Java heap space #26525

@hexinw

Description

@hexinw

Elasticsearch version (bin/elasticsearch --version):
Version: 5.4.2, Build: 929b078/2017-06-15T02:29:28.122Z, JVM: 1.8.0_131

Plugins installed: []

JVM version (java -version):

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)

OS version (uname -a if on a Unix-like system):
Linux dev-v1.0-akshay-es-1 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
Circuit break exception fails to guard against some aggregation search, which causes elasticsearch out of memory exception and brings down elasticsearch node.

Stack trace of the out of memory exception:

[2017-09-01T13:51:20,838][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [node01-es-dev] fatal error in thread [elasticsearch[node01-es-dev][search][T#6]], exiting
java.lang.OutOfMemoryError: Java heap space
        at org.elasticsearch.common.util.PageCacheRecycler$1.newInstance(PageCacheRecycler.java:99) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.PageCacheRecycler$1.newInstance(PageCacheRecycler.java:96) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.recycler.DequeRecycler.obtain(DequeRecycler.java:53) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.recycler.AbstractRecycler.obtain(AbstractRecycler.java:33) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.recycler.DequeRecycler.obtain(DequeRecycler.java:28) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.recycler.FilterRecycler.obtain(FilterRecycler.java:39) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.recycler.Recyclers$3.obtain(Recyclers.java:119) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.recycler.FilterRecycler.obtain(FilterRecycler.java:39) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.PageCacheRecycler.bytePage(PageCacheRecycler.java:147) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.AbstractBigArray.newBytePage(AbstractBigArray.java:117) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.BigByteArray.resize(BigByteArray.java:143) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.BigArrays.resizeInPlace(BigArrays.java:449) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.BigArrays.resize(BigArrays.java:496) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.BigArrays.grow(BigArrays.java:513) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.metrics.cardinality.HyperLogLogPlusPlus.ensureCapacity(HyperLogLogPlusPlus.java:197) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.metrics.cardinality.HyperLogLogPlusPlus.collect(HyperLogLogPlusPlus.java:232) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityAggregator$DirectCollector.collect(CardinalityAggregator.java:199) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:80) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectBucket(BucketsAggregator.java:72) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregator$1.collect(DateHistogramAggregator.java:116) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.AggregatorFactory$MultiBucketAggregatorWrapper$1.collect(AggregatorFactory.java:136) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.collectExistingBucket(BucketsAggregator.java:80) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator.collectGlobalOrd(GlobalOrdinalsStringTermsAggregator.java:129) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator.access$100(GlobalOrdinalsStringTermsAggregator.java:58) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator$2.collect(GlobalOrdinalsStringTermsAggregator.java:168) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.LeafBucketCollector.collect(LeafBucketCollector.java:82) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.apache.lucene.search.MultiCollector$MultiLeafCollector.collect(MultiCollector.java:174) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.scoreAll(Weight.java:254) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
        at org.apache.lucene.search.Weight$DefaultBulkScorer.score(Weight.java:197) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
        at org.apache.lucene.search.BulkScorer.score(BulkScorer.java:39) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:669) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
        at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:473) ~[lucene-core-6.5.1.jar:6.5.1 cd1f23c63abe03ae650c75ec8ccb37762806cc75 - jimczi - 2017-04-21 12:17:15]
[2017-09-01T13:51:20,858][ERROR][o.e.b.ElasticsearchUncaughtExceptionHandler] [node01-es-dev] fatal error in thread [elasticsearch[node01-es-dev][search][T#11]], exiting
java.lang.OutOfMemoryError: Java heap space
        at org.elasticsearch.common.util.BigArrays.newByteArray(BigArrays.java:481) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.util.BigArrays.newByteArray(BigArrays.java:490) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.metrics.cardinality.HyperLogLogPlusPlus.<init>(HyperLogLogPlusPlus.java:171) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.metrics.cardinality.CardinalityAggregator.buildAggregation(CardinalityAggregator.java:145) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.bucketAggregations(BucketsAggregator.java:116) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramAggregator.buildAggregation(DateHistogramAggregator.java:129) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.AggregatorFactory$MultiBucketAggregatorWrapper.buildAggregation(AggregatorFactory.java:147) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.BucketsAggregator.bucketAggregations(BucketsAggregator.java:116) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator.buildAggregation(GlobalOrdinalsStringTermsAggregator.java:239) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.aggregations.AggregationPhase.execute(AggregationPhase.java:129) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:114) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesService.lambda$loadIntoContext$16(IndicesService.java:1107) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesService$$Lambda$2157/565932108.accept(Unknown Source) ~[?:?]
        at org.elasticsearch.indices.IndicesService.lambda$cacheShardLevelResult$18(IndicesService.java:1188) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesService$$Lambda$2158/111751494.get(Unknown Source) ~[?:?]
        at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:160) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesRequestCache$Loader.load(IndicesRequestCache.java:143) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.common.cache.Cache.computeIfAbsent(Cache.java:401) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesRequestCache.getOrCompute(IndicesRequestCache.java:116) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesService.cacheShardLevelResult(IndicesService.java:1194) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.indices.IndicesService.loadIntoContext(IndicesService.java:1106) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:245) ~[elasticsearch-5.4.2.jar:5.4.2]
        at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:262) ~[elasticsearch-5.4.2.jar:5.4.2]

Steps to reproduce:

Please include a minimal but complete recreation of the problem, including
(e.g.) index creation, mappings, settings, query etc. The easier you make for
us to reproduce it, the more likely that somebody will take the time to look at it.

Provide logs (if relevant):
Query DSL that brings down the elasticsearch node.

nodes_info.go                              search_queries_terms.go
nodes_info_test.go                         search_queries_terms_test.go
nodes_stats.go                             search_queries_term_test.go
nodes_stats_test.go                        search_queries_type.go
percolate_test.go                          search_queries_type_test.go
ping.go                                    search_queries_wildcard.go
ping_test.go                               search_queries_wildcard_test.go
plugins.go                                 search_request.go
plugins_test.go                            search_request_test.go
put_template.go                            search_source.go
put_template_test.go                       search_source_test.go
query.go                                   search_suggester_test.go
README.md                                  search_terms_lookup.go
recipes                                    search_terms_lookup_test.go
reindex.go                                 search_test.go
reindex_test.go                            setup_test.go
request.go                                 snapshot_create_repository.go
request_test.go                            snapshot_create_repository_test.go
rescore.go                                 snapshot_delete_repository.go
rescorer.go                                snapshot_delete_repository_test.go
response.go                                snapshot_get_repository.go
retrier.go                                 snapshot_get_repository_test.go
retrier_test.go                            snapshot_verify_repository.go
retry.go                                   snapshot_verify_repository_test.go
retry_test.go                              sort.go
run-es-5.0.0.sh                            sort_test.go
run-es-5.0.1.sh                            suggester_completion_fuzzy.go
run-es-5.1.1.sh                            suggester_completion_fuzzy_test.go
run-es-5.1.2.sh                            suggester_completion.go
run-es-5.2.0.sh                            suggester_completion_test.go
run-es-5.2.1.sh                            suggester_context_category.go
run-es-5.2.2.sh                            suggester_context_category_test.go
            "fuzzy_max_expansions" : 50,
            "phrase_slop" : 0,
            "analyze_wildcard" : true,
            "escape" : false,
            "split_on_whitespace" : true,
            "boost" : 1.0
          }
        }
      ],
      "disable_coord" : false,
      "adjust_pure_negative" : true,
      "boost" : 1.0
    }
  },
  "aggregations" : {
    "4" : {
      "terms" : {
        "field" : "node_uuid",
        "size" : 500,
        "min_doc_count" : 1,
        "shard_min_doc_count" : 0,
        "show_term_doc_count_error" : false,
        "order" : [
          {
            "_term" : "desc"
          }
        ]
      },
      "aggregations" : {
        "2" : {
          "date_histogram" : {
            "field" : "timestamp",
            "format" : "epoch_millis",
            "interval" : "5m",
            "offset" : 0,
            "order" : {
              "_key" : "asc"
            },
            "keyed" : false,
            "min_doc_count" : 0,
            "extended_bounds" : {
              "min" : "1504126054711",
              "max" : "1504298854711"
            }
          },
          "aggregations" : {
            "1" : {
              "cardinality" : {
                "field" : "pid"
              }
            }
          }
        }
      }
    }
  }
}}] lastShard [true]

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/Circuit BreakersTrack estimates of memory consumption to prevent overload

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions