Skip to content

HDR percentile aggregation over a field with negative numbers return 500 error code #115777

@iverase

Description

@iverase

We currently throw an ArrayIndexOutOfBoundsException that is not handle properly so it results in a 500 internal server error code. This should be changed to an IllegalArgumentException.

Failed to execute phase [query], all shards failed; shardFailures {[6B2TJotYQ3ih-TClllWjNQ][negative_numbers_idx][0]: org.elasticsearch.transport.RemoteTransportException: [node_s0][127.0.0.1:13961][indices:data/read/search[phase/query]]
Caused by: org.elasticsearch.search.query.QueryPhaseExecutionException: Query Failed [Failed to execute main query]
	at org.elasticsearch.search.query.QueryPhase.addCollectorsAndSearch(QueryPhase.java:237)
	at org.elasticsearch.search.query.QueryPhase.executeQuery(QueryPhase.java:143)
	at org.elasticsearch.search.query.QueryPhase.execute(QueryPhase.java:70)
	at org.elasticsearch.search.SearchService.loadOrExecuteQueryPhase(SearchService.java:547)
	at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:707)
	at org.elasticsearch.search.SearchService.lambda$executeQueryPhase$2(SearchService.java:574)
	at org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:79)
	at org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:76)
	at org.elasticsearch.action.ActionRunnable$4.doRun(ActionRunnable.java:101)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27)
	at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:34)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1023)
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1570)
Caused by:java.lang.ArrayIndexOutOfBoundsException: Negative values cannot be recorded
	at HdrHistogram@2.1.9/org.HdrHistogram.DoubleHistogram.autoAdjustRangeForValueSlowPath(DoubleHistogram.java:412)
	at HdrHistogram@2.1.9/org.HdrHistogram.DoubleHistogram.autoAdjustRangeForValue(DoubleHistogram.java:378)
	at HdrHistogram@2.1.9/org.HdrHistogram.DoubleHistogram.recordSingleValue(DoubleHistogram.java:345)
        at HdrHistogram@2.1.9/org.HdrHistogram.DoubleHistogram.recordValue(DoubleHistogram.java:290)
        at org.elasticsearch.search.aggregations.metrics.AbstractHDRPercentilesAggregator$2.collect(AbstractHDRPercentilesAggregator.java:79)
	at org.elasticsearch.search.aggregations.LeafBucketCollector.collect(LeafBucketCollector.java:87)
	at org.elasticsearch.search.query.QueryPhaseCollector$CompositeLeafCollector.collect(QueryPhaseCollector.java:307)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions