Skip to content

Commit 2b5ad2e

Browse files
committed
update
1 parent 20bfd94 commit 2b5ad2e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

server/src/main/java/org/elasticsearch/action/search/SearchQueryThenFetchAsyncAction.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,18 +843,25 @@ void onShardDone() {
843843
var channelListener = new ChannelActionListener<>(channel);
844844
RecyclerBytesStreamOutput out = dependencies.transportService.newNetworkBytesStream();
845845
out.setTransportVersion(channel.getVersion());
846+
847+
boolean success = false;
846848
try (queryPhaseResultConsumer) {
847849
Exception reductionFailure = queryPhaseResultConsumer.failure.get();
848850
if (reductionFailure == null) {
849851
writeSuccessfulResponse(out);
850852
} else {
851853
writeReductionFailureResponse(out, reductionFailure);
852854
}
855+
success = true;
853856
} catch (IOException e) {
854857
releaseAllResultsContexts();
855858
channelListener.onFailure(e);
856859
return;
857-
}
860+
} finally {
861+
if (success == false) {
862+
out.close();
863+
}
864+
858865
ActionListener.respondAndRelease(channelListener, new BytesTransportResponse(out.moveToBytesReference()));
859866
}
860867

0 commit comments

Comments
 (0)