Skip to content

Commit 814c717

Browse files
authored
Release ref on cancellation in GetSnapshotInfoExecutor (elastic#120529) (elastic#120697)
Not a bug today because we also throttle calls to `getSnapshotInfo` so we never run out of refs before processing all the cancelled tasks, but still we should release `ref` on every path through this method.
1 parent 34d37ce commit 814c717

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,9 @@ int getMaxRunningTasks() {
721721
void getSnapshotInfo(Repository repository, SnapshotId snapshotId, ActionListener<SnapshotInfo> listener) {
722722
enqueueTask(listener.delegateFailure((l, ref) -> {
723723
if (isCancelledSupplier.getAsBoolean()) {
724-
l.onFailure(new TaskCancelledException("task cancelled"));
724+
try (ref) {
725+
l.onFailure(new TaskCancelledException("task cancelled"));
726+
}
725727
} else {
726728
repository.getSnapshotInfo(snapshotId, ActionListener.releaseAfter(l, ref));
727729
}

0 commit comments

Comments
 (0)