Skip to content

Commit

Permalink
Fix Stack Overflow in UnassignedInfo in Corner Case (#76480) (#76546)
Browse files Browse the repository at this point in the history
We kept wrapping the collection over and over again which in extreme corner cases could lead to a SOE.

Closes #76490

Co-authored-by: hanbj <hanbj0707@163.com>
  • Loading branch information
original-brownbear and hanbj authored Aug 16, 2021
1 parent 57092cc commit 2f556ef
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public UnassignedInfo(Reason reason, @Nullable String message, @Nullable Excepti
this.failure = failure;
this.failedAllocations = failedAllocations;
this.lastAllocationStatus = Objects.requireNonNull(lastAllocationStatus);
this.failedNodeIds = Collections.unmodifiableSet(failedNodeIds);
this.failedNodeIds = org.elasticsearch.core.Set.copyOf(failedNodeIds);
assert (failedAllocations > 0) == (reason == Reason.ALLOCATION_FAILED) :
"failedAllocations: " + failedAllocations + " for reason " + reason;
assert (message == null && failure != null) == false : "provide a message if a failure exception is provided";
Expand Down

0 comments on commit 2f556ef

Please sign in to comment.