Преглед изворни кода

Release ref on cancellation in `GetSnapshotInfoExecutor` (#120529) (#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.
David Turner пре 8 месеци
родитељ
комит
814c717f40

+ 3 - 1
server/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/get/TransportGetSnapshotsAction.java

@@ -721,7 +721,9 @@ public class TransportGetSnapshotsAction extends TransportMasterNodeAction<GetSn
         void getSnapshotInfo(Repository repository, SnapshotId snapshotId, ActionListener<SnapshotInfo> listener) {
             enqueueTask(listener.delegateFailure((l, ref) -> {
                 if (isCancelledSupplier.getAsBoolean()) {
-                    l.onFailure(new TaskCancelledException("task cancelled"));
+                    try (ref) {
+                        l.onFailure(new TaskCancelledException("task cancelled"));
+                    }
                 } else {
                     repository.getSnapshotInfo(snapshotId, ActionListener.releaseAfter(l, ref));
                 }