Instead we should use `org.elasticsearch.tasks.CancellableTask#addListener` to add a listener which sets `failure` on cancellation.
x-pack/plugin/snapshot-repo-test-kit/src/main/java/org/elasticsearch/repositories/blobstore/testkit/RepositoryAnalyzeAction.java
detailed = in.readBoolean();
            reroutedFrom = in.readOptionalWriteable(DiscoveryNode::new);
            if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_14_0)) {
                abortWritePermitted = in.readBoolean();
            } else {
                abortWritePermitted = false;
            }
        }
        @Override
        public ActionRequestValidationException validate() {
            return null;
        }
        @Override
        public void writeTo(StreamOutput out) throws IOException {
            super.writeTo(out);
            out.writeString(repositoryName);
            out.writeLong(seed);
            out.writeDouble(rareActionProbability);
            out.writeVInt(blobCount);
            out.writeVInt(concurrency);
            out.writeVInt(readNodeCount);
            out.writeVInt(earlyReadNodeCount);
            out.writeTimeValue(timeout);
            maxBlobSize.writeTo(out);
            maxTotalDataSize.writeTo(out);
            out.writeBoolean(detailed);
            out.writeOptionalWriteable(reroutedFrom);
            if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_14_0)) {
                out.writeBoolean(abortWritePermitted);
            } else if (abortWritePermitted) {