apache/pulsar · warning · RuntimeException
Failed to clone ClientConfigurationData
Error message
Failed to clone ClientConfigurationData
What it means
ClientConfigurationData.clone() relies on Object.clone() (the class implements Cloneable). CloneNotSupportedException is theoretically impossible for a Cloneable class, but clone() still wraps it in a RuntimeException "Failed to clone ClientConfigurationData" as a defensive measure. Called by PulsarChannelInitializer when it needs a per-connection copy of the config.
Source
Thrown at pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java:606
*
* @param out the object output stream
* @throws IOException if the configuration cannot be written
*/
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
if (v5Authentication != null && StringUtils.isBlank(authPluginClassName)) {
throw new NotSerializableException("A v5 authentication plugin ("
+ v5Authentication.getClass().getName() + ") cannot be serialized with the client "
+ "configuration. Configure authentication with authPluginClassName + authParams instead "
+ "of a pre-built plugin instance when the configuration has to cross a boundary.");
}
out.defaultWriteObject();
}
public ClientConfigurationData clone() {
try {
return (ClientConfigurationData) super.clone();
} catch (CloneNotSupportedException e) {
throw new RuntimeException("Failed to clone ClientConfigurationData");
}
}
public InetSocketAddress getSocks5ProxyAddress() {
if (Objects.nonNull(socks5ProxyAddress)) {
return socks5ProxyAddress;
}
String proxyAddress = System.getProperty("socks5Proxy.address");
return Optional.ofNullable(proxyAddress).map(address -> {
try {
URI uri = URI.create(address);
return new InetSocketAddress(uri.getHost(), uri.getPort());
} catch (Exception e) {
throw new RuntimeException("Invalid config [socks5Proxy.address]", e);
}
}).orElse(null);
}
View on GitHub (pinned to 820761864e)
Solutions
- Verify ClientConfigurationData still implements Cloneable in your build (no shading/bytecode issue).
- Update/repair the Pulsar client jar — a stock build cannot trigger this path.
- If it reproduces with an agent installed, exclude the pulsar-client classes from instrumentation.
Defensive patterns
Strategy: try-catch
Try / catch
try {
ClientConfigurationData copy = conf.clone();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().equals("Failed to clone ClientConfigurationData")) {
// bytecode/agent or shading issue; rebuild config manually
} else throw e;
} Prevention
- Don't remove 'implements Cloneable' when forking or shading pulsar-client.
- Check bytecode agents (APM, coverage) exclude org.apache.pulsar classes if this ever fires.
- Keep the client jar unmodified from the official release.
When it happens
Trigger: Practically unreachable: it fires only if super.clone() throws CloneNotSupportedException, which would mean the class lost its Cloneable marker (e.g. bytecode manipulation, unusual classloading, or a fork removing 'implements Cloneable').
Common situations: Agent/bytecode-weaving tools or shaded builds interfering with class metadata; custom forks of Pulsar that altered the class hierarchy.
Related errors
- Failed to clone ConsumerConfigurationData
- Failed to clone ProducerConfigurationData
- Failed to clone ReaderConfigurationData
- Timeout during mark-delete operation
- Timeout during clear backlog operation
AI-assisted analysis of apache/pulsar@820761864e (2026-09-06).
Data as JSON: /api/errors/c7b1acc47210ad2e.
Report an issue: GitHub.