apache/pulsar · error · PulsarServerException
Failed to close the channel.
Error message
Failed to close the channel.
What it means
ServiceUnitStateChannelImpl.close failed during channel teardown (broker registry close, monitor task cancel, listener close); the original exception is wrapped in a PulsarServerException with this message.
Source
Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:405
brokerRegistry = null;
}
if (monitorTask != null) {
monitorTask.cancel(true);
monitorTask = null;
log.info("Successfully cancelled the cleanup tasks");
}
if (stateChangeListeners != null) {
stateChangeListeners.close();
}
log.info("Successfully closed the channel.");
} catch (Exception e) {
String msg = "Failed to close the channel.";
log.error().exception(e).log(msg);
throw new PulsarServerException(msg, e);
}
}
private boolean validateChannelState(ChannelState targetState, boolean checkLowerIds) {
int order = checkLowerIds ? -1 : 1;
if (Integer.compare(channelState.id, targetState.id) * order > 0) {
return false;
}
return true;
}
private boolean debug() {
return ExtensibleLoadManagerImpl.debug(config, log);
}
@Override
public CompletableFuture<Optional<String>> getChannelOwnerAsync() {
if (!validateChannelState(LeaderElectionServiceStarted, true)) {View on GitHub (pinned to 820761864e)
Solutions
- Inspect the wrapped cause in logs; often a metadata-store disconnect during shutdown
- Retry shutdown after resolving the underlying resource issue
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java:405 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/cd788b068cc57f21.
Report an issue: GitHub.