apache/pulsar · error · org.apache.pulsar.client.impl.v5.PulsarClientException
${cause}
Error message
${cause} What it means
Thrown by MultiTopicStreamConsumer.close() when closeAsync() completes exceptionally; the ExecutionException is unwrapped and rethrown as a PulsarClientException wrapping the original cause. Indicates one or more per-topic stream consumer closes failed.
Source
Thrown at pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/MultiTopicStreamConsumer.java:361
}
action.accept(state.consumer, entry.getValue());
}
}
@Override
public AsyncStreamConsumer<T> async() {
return asyncView;
}
@Override
public void close() throws PulsarClientException {
try {
closeAsync().get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new PulsarClientException("Close interrupted", e);
} catch (ExecutionException e) {
throw new PulsarClientException(e.getCause());
}
}
CompletableFuture<Void> closeAsync() {
if (closed) {
return CompletableFuture.completedFuture(null);
}
closed = true;
watcher.close();
mux.close();
// Cancel pending retries for topics that never finished subscribing (they're not in
// perTopic, so the closeTopic loop below wouldn't reach them).
retryTimeouts.values().forEach(Timeout::cancel);
retryTimeouts.clear();
List<CompletableFuture<Void>> closes = new ArrayList<>();
for (var topic : new HashSet<>(perTopic.keySet())) {
closes.add(closeTopic(topic));
}View on GitHub (pinned to 820761864e)
Solutions
- Log and inspect the wrapped cause (e.getCause())
- Retry closeAsync() after connectivity is restored
- Track closed state and treat a failed close as best-effort during shutdown
Example fix
// before
streamConsumer.close();
// after
try {
streamConsumer.close();
} catch (PulsarClientException e) {
log.warn("stream close failed: {}", e.getCause());
} Defensive patterns
Strategy: try-catch
Try / catch
try { streamConsumer.close(); } catch (PulsarClientException e) { log.warn("close failed: {}", e.getCause()); } Prevention
- Retry close after connectivity restores
- Treat close errors as best-effort during shutdown and log the cause
When it happens
Trigger: Broker unreachable during close, per-topic consumer close errors, or client-level failures while shutting down the subscription.
Common situations: Closing during network partitions; broker restarts; double-close after client.shutdown().
Related errors
- ${cause}
- Close interrupted
- Close interrupted
- Try to reserve/release memory failed, the param memorySize i
- Failed to decode message from topic ${topic} with schemaId $
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/8786b77ab3b158fa.
Report an issue: GitHub.