diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java index 6c7624d8fa754..f618ccb49ab34 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java @@ -877,6 +877,7 @@ public static MultiTopicsConsumerImpl createPartitionedConsumer(PulsarCli .exceptionally(e -> { log.warn("Failed subscription for createPartitionedConsumer: {} {}, e:{}", topicName, numPartitions, e); + consumer.cleanupMultiConsumer(); subscribeFuture.completeExceptionally( PulsarClientException.wrap(((Throwable) e).getCause(), String.format("Failed to subscribe %s with %d partitions", topicName, numPartitions))); return null;