Skip to content

Commit

Permalink
Fix Stack Overflow in UnassignedInfo in Corner Case (elastic#76480)
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 elastic#76490
  • Loading branch information
hanbj authored and original-brownbear committed Aug 16, 2021
1 parent 8fe2ee7 commit 8aca61c
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 8aca61c

Please sign in to comment.