elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.19k stars 24.85k forks source link

reindex causes java.lang.ArrayIndexOutOfBoundsException after upgrade to 8.7.1 #96078

Closed voran closed 1 year ago

voran commented 1 year ago

Elasticsearch Version

8.7.1

Installed Plugins

none

Java Version

bundled

OS Version

docker.elastic.co/elasticsearch/elasticsearch:8.7.1

Problem Description

We have cluster with about 20 nodes (4 vCPU, 32GB RAM) on Google Cloud running version 8.4.2 and an index with parent-child and about 6TB of data (60 shards, 1 replica) that was indexed using an older version (8.3.2).

We recently upgraded to version 8.7.1 via rolling restart, and when we try to reindex, we see consistent errrors in some shards as follows: java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -3 is negative (see logs for full traces).

Cluster is green and there is no other indication of shard corruption. We were able to reindex from this same index successfully before the upgrade from 8.4.2 to 8.7.1.

In all cases, it's always "length -3 is negative".

Both stack traces refer to RecyclerBytesStreamOutput, and this is something that was changed in this version (https://github.com/elastic/elasticsearch/pull/95036). Without being experts, we suspect that this PR introduces a bug which causes this particular failure.

Steps to Reproduce

I cannot share a minimal dataset to reproduce this yet, but here is the output of GET /<index> including the index settings and mapping.

Presumably, if you:

  1. generate some data and put it in this index with version 8.3.2
  2. you do a rolling upgrade to 8.4.2
  3. you do a rolling upgrade to 8.7.1
  4. you try to reindex this using automatic slicing, and a query into a index with a larger number of shards

You will get the same error for some of the reindex slices. If you run the reindex without slicing, it would still fail with the same error.

elasticserach uses these settings:

  cluster.initial_master_nodes: elasticsearch-tracking-0,elasticsearch-tracking-1,elasticsearch-tracking-2
  discovery.seed_hosts: elasticsearch-tracking-2.es-tracking.default.svc.cluster.local,elasticsearch-tracking-1.es-tracking.default.svc.cluster.local,elasticsearch-tracking-0.es-tracking.default.svc.cluster.local
  ES_JAVA_OPTS: -Xms10240m -Xmx10240m
  xpack.graph.enabled: "false"
  xpack.ml.enabled: "false"
  xpack.monitoring.collection.enabled: "true"
  xpack.security.enabled: "false"
  xpack.watcher.enabled: "false"
  xpack.monitoring.collection.interval: '30s'
  action.auto_create_index: "+.monitoring-kibana*,+.monitoring-es*,+.kibana_*"
  search.max_open_scroll_context: "1000"

Logs (if relevant)

1st type: Message: failed to serialize outbound message [Response{456614}{false}{false}{false}{class org.elasticsearch.search.fetch.FetchSearchResult}] Stack:

java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -3 is negative
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.RecyclerBytesStreamOutput.writeBytes(RecyclerBytesStreamOutput.java:86)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.writeBytes(StreamOutput.java:120)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:436)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:401)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.writeMap(StreamOutput.java:639)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.search.SearchHit.writeTo(SearchHit.java:253)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.lambda$writeArray$31(StreamOutput.java:956)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.writeArray(StreamOutput.java:933)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.io.stream.StreamOutput.writeArray(StreamOutput.java:956)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.search.SearchHits.writeTo(SearchHits.java:100)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.search.fetch.FetchSearchResult.writeTo(FetchSearchResult.java:53)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.OutboundMessage.serialize(OutboundMessage.java:70)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.OutboundHandler.sendMessage(OutboundHandler.java:178)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.OutboundHandler.sendResponse(OutboundHandler.java:138)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:57)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:41)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ChannelActionListener.lambda$onResponse$0(ChannelActionListener.java:38)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionListener.run(ActionListener.java:567)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:38)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:20)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:1131)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:958)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    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:1623)

2-nd type: Failed to execute phase [fetch], Partial shards failure; shardFailures {[W-OgW1gmQ3qFNOuZKwHtOw][profiles_reindex3][51]: org.elasticsearch.transport.RemoteTransportException: [elasticsearch-tracking-15][10.84.22.6:9300][indices:data/read/search[phase/fetch/id]]

Caused by: java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -3 is negative
    at java.lang.System.arraycopy(Native Method)
    at org.elasticsearch.common.io.stream.RecyclerBytesStreamOutput.writeBytes(RecyclerBytesStreamOutput.java:86)
    at org.elasticsearch.common.io.stream.StreamOutput.writeBytes(StreamOutput.java:120)
    at org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:436)
    at org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:401)
    at org.elasticsearch.common.io.stream.StreamOutput.writeMap(StreamOutput.java:639)
    at org.elasticsearch.search.SearchHit.writeTo(SearchHit.java:253)
    at org.elasticsearch.common.io.stream.StreamOutput.lambda$writeArray$31(StreamOutput.java:956)
    at org.elasticsearch.common.io.stream.StreamOutput.writeArray(StreamOutput.java:933)
    at org.elasticsearch.common.io.stream.StreamOutput.writeArray(StreamOutput.java:956)
    at org.elasticsearch.search.SearchHits.writeTo(SearchHits.java:100)
    at org.elasticsearch.search.fetch.FetchSearchResult.writeTo(FetchSearchResult.java:53)
    at org.elasticsearch.transport.OutboundMessage.serialize(OutboundMessage.java:70)
    at org.elasticsearch.transport.OutboundHandler.sendMessage(OutboundHandler.java:178)
    at org.elasticsearch.transport.OutboundHandler.sendResponse(OutboundHandler.java:138)
    at org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:57)
    at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:41)
    at org.elasticsearch.action.support.ChannelActionListener.lambda$onResponse$0(ChannelActionListener.java:38)
    at org.elasticsearch.action.ActionListener.run(ActionListener.java:567)
    at org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:38)
    at org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:20)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:1131)
    at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
    at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
    at org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:958)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.lang.Thread.run(Thread.java:1623)
}
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.AbstractSearchAsyncAction.onPhaseFailure(AbstractSearchAsyncAction.java:728)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.AbstractSearchAsyncAction.executeNextPhase(AbstractSearchAsyncAction.java:432)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.FetchSearchPhase.moveToNextPhase(FetchSearchPhase.java:271)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.FetchSearchPhase.lambda$innerRun$2(FetchSearchPhase.java:108)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.CountedCollector.countDown(CountedCollector.java:40)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.CountedCollector.onFailure(CountedCollector.java:59)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.FetchSearchPhase$2.onFailure(FetchSearchPhase.java:225)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionListenerResponseHandler.handleException(ActionListenerResponseHandler.java:48)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.SearchTransportService$ConnectionCountingHandler.handleException(SearchTransportService.java:644)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.TransportService$UnregisterChildTransportResponseHandler.handleException(TransportService.java:1651)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1377)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.doHandleException(InboundHandler.java:442)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.handleException(InboundHandler.java:429)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.handlerResponseError(InboundHandler.java:420)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:142)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.inboundMessage(InboundHandler.java:97)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.TcpTransport.inboundMessage(TcpTransport.java:829)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundPipeline.forwardFragments(InboundPipeline.java:150)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundPipeline.doHandleBytes(InboundPipeline.java:121)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundPipeline.handleBytes(InboundPipeline.java:86)
    at org.elasticsearch.transport.netty4@8.7.1/org.elasticsearch.transport.netty4.Netty4MessageInboundHandler.channelRead(Netty4MessageInboundHandler.java:63)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler@4.1.86.Final/io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:280)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.codec@4.1.86.Final/io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.transport@4.1.86.Final/io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at io.netty.transport@4.1.86.Final/io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.transport@4.1.86.Final/io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
    at io.netty.transport@4.1.86.Final/io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
    at io.netty.transport@4.1.86.Final/io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
    at io.netty.transport@4.1.86.Final/io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:689)
    at io.netty.transport@4.1.86.Final/io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:652)
    at io.netty.transport@4.1.86.Final/io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
    at io.netty.common@4.1.86.Final/io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
    at io.netty.common@4.1.86.Final/io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: org.elasticsearch.ElasticsearchException$1: arraycopy: length -3 is negative
    at org.elasticsearch.server@8.7.1/org.elasticsearch.ElasticsearchException.guessRootCauses(ElasticsearchException.java:668)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.SearchPhaseExecutionException.guessRootCauses(SearchPhaseExecutionException.java:150)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.search.SearchPhaseExecutionException.getCause(SearchPhaseExecutionException.java:95)
    at java.base/java.lang.Throwable.lockedPrintStackTrace(Throwable.java:694)
    at java.base/java.lang.Throwable.printStackTrace(Throwable.java:673)
    at java.base/java.lang.Throwable.printStackTrace(Throwable.java:749)
    at ecs.logging.core@1.2.0/co.elastic.logging.EcsJsonSerializer.formatThrowable(EcsJsonSerializer.java:242)
    at ecs.logging.core@1.2.0/co.elastic.logging.EcsJsonSerializer.serializeException(EcsJsonSerializer.java:207)
    at log4j2.ecs.layout@1.2.0/co.elastic.logging.log4j2.EcsLayout.toText(EcsLayout.java:140)
    at log4j2.ecs.layout@1.2.0/co.elastic.logging.log4j2.EcsLayout.encode(EcsLayout.java:115)
    at log4j2.ecs.layout@1.2.0/co.elastic.logging.log4j2.EcsLayout.encode(EcsLayout.java:59)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputStreamAppender.java:215)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppender.java:208)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:199)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:161)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:134)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:125)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:89)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:683)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:641)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:624)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:560)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:82)
    at org.apache.logging.log4j.core@8.7.1/org.apache.logging.log4j.core.Logger.log(Logger.java:162)
    at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2205)
    at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
    at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
    at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2012)
    at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1868)
    at org.apache.logging.log4j@2.19.0/org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2681)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.LoggingTaskListener.onFailure(LoggingTaskListener.java:39)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionListener.completeWith(ActionListener.java:502)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ListenableActionFuture.executeListener(ListenableActionFuture.java:83)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ListenableActionFuture.done(ListenableActionFuture.java:75)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.common.util.concurrent.BaseFuture.setException(BaseFuture.java:149)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.PlainActionFuture.onFailure(PlainActionFuture.java:68)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.client.internal.node.NodeClient$SafelyWrappedActionListener.onFailure(NodeClient.java:170)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$1.onFailure(TaskManager.java:218)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$2.onResponse(TaskManager.java:361)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$2.onResponse(TaskManager.java:358)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskResultsService$1.onResponse(TaskResultsService.java:95)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskResultsService$1.onResponse(TaskResultsService.java:92)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:31)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.client.internal.node.NodeClient$SafelyWrappedActionListener.onResponse(NodeClient.java:160)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$1.onResponse(TaskManager.java:209)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$1.onResponse(TaskManager.java:203)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.bulk.TransportBulkAction.lambda$unwrappingSingleItemBulkResponse$0(TransportBulkAction.java:188)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionListener$2.onResponse(ActionListener.java:167)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.ActionListener$RunBeforeActionListener.onResponse(ActionListener.java:440)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation$1.finishHim(TransportBulkAction.java:658)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation$1.onResponse(TransportBulkAction.java:639)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.bulk.TransportBulkAction$BulkOperation$1.onResponse(TransportBulkAction.java:628)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.client.internal.node.NodeClient$SafelyWrappedActionListener.onResponse(NodeClient.java:160)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$1.onResponse(TaskManager.java:209)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.tasks.TaskManager$1.onResponse(TaskManager.java:203)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase.finishOnSuccess(TransportReplicationAction.java:1049)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase$1.handleResponse(TransportReplicationAction.java:961)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.action.support.replication.TransportReplicationAction$ReroutePhase$1.handleResponse(TransportReplicationAction.java:952)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleResponse(TransportService.java:1367)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.doHandleResponse(InboundHandler.java:400)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.handleResponse(InboundHandler.java:349)
    at org.elasticsearch.server@8.7.1/org.elasticsearch.transport.InboundHandler.messageReceived(InboundHandler.java:144)
    ... 29 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: arraycopy: length -3 is negative
    at java.lang.System.arraycopy(Native Method)
    at org.elasticsearch.common.io.stream.RecyclerBytesStreamOutput.writeBytes(RecyclerBytesStreamOutput.java:86)
    at org.elasticsearch.common.io.stream.StreamOutput.writeBytes(StreamOutput.java:120)
    at org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:436)
    at org.elasticsearch.common.io.stream.StreamOutput.writeString(StreamOutput.java:401)
    at org.elasticsearch.common.io.stream.StreamOutput.writeMap(StreamOutput.java:639)
    at org.elasticsearch.search.SearchHit.writeTo(SearchHit.java:253)
    at org.elasticsearch.common.io.stream.StreamOutput.lambda$writeArray$31(StreamOutput.java:956)
    at org.elasticsearch.common.io.stream.StreamOutput.writeArray(StreamOutput.java:933)
    at org.elasticsearch.common.io.stream.StreamOutput.writeArray(StreamOutput.java:956)
    at org.elasticsearch.search.SearchHits.writeTo(SearchHits.java:100)
    at org.elasticsearch.search.fetch.FetchSearchResult.writeTo(FetchSearchResult.java:53)
    at org.elasticsearch.transport.OutboundMessage.serialize(OutboundMessage.java:70)
    at org.elasticsearch.transport.OutboundHandler.sendMessage(OutboundHandler.java:178)
    at org.elasticsearch.transport.OutboundHandler.sendResponse(OutboundHandler.java:138)
    at org.elasticsearch.transport.TcpTransportChannel.sendResponse(TcpTransportChannel.java:57)
    at org.elasticsearch.transport.TaskTransportChannel.sendResponse(TaskTransportChannel.java:41)
    at org.elasticsearch.action.support.ChannelActionListener.lambda$onResponse$0(ChannelActionListener.java:38)
    at org.elasticsearch.action.ActionListener.run(ActionListener.java:567)
    at org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:38)
    at org.elasticsearch.action.support.ChannelActionListener.onResponse(ChannelActionListener.java:20)
    at org.elasticsearch.search.SearchService$2.onResponse(SearchService.java:1131)
    at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:50)
    at org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:47)
    at org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:72)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at org.elasticsearch.common.util.concurrent.TimedRunnable.doRun(TimedRunnable.java:33)
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:958)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.lang.Thread.run(Thread.java:1623)
voran commented 1 year ago

Looking through the file history it seems like this might be adressed by https://github.com/elastic/elasticsearch/pull/95114. Fingers crossed for a new release soon as this cauing a production issue for us.

Also, it may be a good idea to put this as a known issue for version 8.7.1 to prevent others from ending up where we are.

dnhatn commented 1 year ago

Thank you for reporting the issue. I am closing this issue, as it appears that the problem was fixed in #95114.

DaveCTurner commented 1 year ago

Also, it may be a good idea to put this as a known issue for version 8.7.1 to prevent others from ending up where we are.

I agree, I opened https://github.com/elastic/elasticsearch/pull/96448.