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

[date_histogram aggregation] OutOfMemoryError when using "time_zone" attribute #6965

Closed
boillodmanuel opened this Issue Jul 22, 2014 · 6 comments

Comments

Projects
None yet
5 participants
@boillodmanuel
Copy link

boillodmanuel commented Jul 22, 2014

Elasticsearch version : 1.2.2
Operation : date_histogram aggregation

In date_histogram aggregation (documentation), when I use the "time_zone" attribute, I have an OutOfMemoryError (see response below).

{
   "error": "ReduceSearchPhaseException[Failed to execute phase [fetch], [reduce] ]; nested: OutOfMemoryError[Java heap space]; ",
   "status": 503
}

The complete stacktrace is:

[2014-07-22 19:01:15,800][DEBUG][action.search.type       ] [Briquette] failed to reduce search
org.elasticsearch.action.search.ReduceSearchPhaseException: Failed to execute phase [fetch], [reduce] 
    at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.finishHim(TransportSearchQueryThenFetchAction.java:140)
    at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction$1.onResult(TransportSearchQueryThenFetchAction.java:112)
    at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction$1.onResult(TransportSearchQueryThenFetchAction.java:106)
    at org.elasticsearch.search.action.SearchServiceTransportAction$23.run(SearchServiceTransportAction.java:526)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.OutOfMemoryError: Java heap space
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogram.createBucket(InternalDateHistogram.java:146)
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogram.createBucket(InternalDateHistogram.java:36)
    at org.elasticsearch.search.aggregations.bucket.histogram.InternalHistogram.reduce(InternalHistogram.java:324)
    at org.elasticsearch.search.aggregations.InternalAggregations.reduce(InternalAggregations.java:140)
    at org.elasticsearch.search.controller.SearchPhaseController.merge(SearchPhaseController.java:545)
    at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.innerFinishHim(TransportSearchQueryThenFetchAction.java:151)
    at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.finishHim(TransportSearchQueryThenFetchAction.java:138)
    ... 6 more

Query detail :

POST index/type/_search
{
  "query": {
    "filtered": {
      "query": {
        "match_all": {}
      }
    }
  },
  "aggregations": {
    "tendance": {
      "date_histogram": {
        "field": "date_creation",
        "interval": "month",
        "min_doc_count": 0,
        "time_zone": 1,
        "extended_bounds": {
          "min": "2013-01-01T00:00:00.000+01:00",
          "max": "2013-01-31T23:59:59.999+01:00"
        }
      }
    }
  }
}

With "time_zone": "Europe/Paris", I have the same error.
With "time_zone": 0, everything is good and the query tooks 19ms.

The document mapping is:

"mappings":{  
      "marche_prive":{  
         "properties":{  
            "date_creation":{  
               "include_in_all":false,
               "store":true,
               "format":"dateOptionalTime",
               "type":"date"
            }
         }
      }
   }

I haven't any ideas of what happens!

@boillodmanuel

This comment has been minimized.

Copy link
Author

boillodmanuel commented Jul 22, 2014

The java heap histogram shows a very high number of InternalDateHistogram$Bucket instances:

 num     #instances         #bytes  class name
----------------------------------------------
   1:      45469412     1818776480  org.elasticsearch.search.aggregations.bucket.histogram.InternalDateHistogram$Bucket
@boillodmanuel

This comment has been minimized.

Copy link
Author

boillodmanuel commented Jul 23, 2014

Without using "min_doc_count" attribute, the query ends normally.

"date_histogram": {
        "field": "date_creation",
        "interval": "month",
        "min_doc_count": 0,
        "time_zone": 1
      }

does not work, but

"date_histogram": {
        "field": "date_creation",
        "interval": "month",
        "time_zone": 1
      }

works fine

@jpountz

This comment has been minimized.

Copy link
Contributor

jpountz commented Jul 24, 2014

Thanks for the report, this looks like an infinite loop in the reduce logic. I will look into it...

jpountz added a commit to jpountz/elasticsearch that referenced this issue Jul 24, 2014

Aggregations: Fix infinite loop in the histogram reduce logic.
The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close elastic#6965

jpountz added a commit that referenced this issue Aug 1, 2014

Aggregations: Fix infinite loop in the histogram reduce logic.
The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close #6965

@jpountz jpountz closed this in a9d5c03 Aug 1, 2014

jpountz added a commit that referenced this issue Aug 1, 2014

Aggregations: Fix infinite loop in the histogram reduce logic.
The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close #6965

@jpountz jpountz removed the bug label Aug 1, 2014

@annirvine

This comment has been minimized.

Copy link

annirvine commented Aug 1, 2014

Do you know if this was a bug in 1.1 also and, if so, if it has been fixed there as well?

@wojcikstefan

This comment has been minimized.

Copy link

wojcikstefan commented Aug 6, 2014

Hi there, I encountered the same issue in ES 1.1.2.

@wojcikstefan

This comment has been minimized.

Copy link

wojcikstefan commented Aug 7, 2014

@jpountz, are you planning to include this fix in the 1.2 branch as well?

jpountz added a commit that referenced this issue Sep 8, 2014

Aggregations: Fix infinite loop in the histogram reduce logic.
The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close #6965

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

Aggregations: Fix infinite loop in the histogram reduce logic.
The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close elastic#6965
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.