{"record":{"id":"c7b1acc47210ad2e","repo":"apache/pulsar","slug":"failed-to-clone-clientconfigurationdata","errorCode":null,"errorMessage":"Failed to clone ClientConfigurationData","messagePattern":"Failed to clone ClientConfigurationData","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java","lineNumber":606,"sourceCode":"     *\n     * @param out the object output stream\n     * @throws IOException if the configuration cannot be written\n     */\n    private void writeObject(java.io.ObjectOutputStream out) throws IOException {\n        if (v5Authentication != null && StringUtils.isBlank(authPluginClassName)) {\n            throw new NotSerializableException(\"A v5 authentication plugin (\"\n                    + v5Authentication.getClass().getName() + \") cannot be serialized with the client \"\n                    + \"configuration. Configure authentication with authPluginClassName + authParams instead \"\n                    + \"of a pre-built plugin instance when the configuration has to cross a boundary.\");\n        }\n        out.defaultWriteObject();\n    }\n\n    public ClientConfigurationData clone() {\n        try {\n            return (ClientConfigurationData) super.clone();\n        } catch (CloneNotSupportedException e) {\n            throw new RuntimeException(\"Failed to clone ClientConfigurationData\");\n        }\n    }\n\n    public InetSocketAddress getSocks5ProxyAddress() {\n        if (Objects.nonNull(socks5ProxyAddress)) {\n            return socks5ProxyAddress;\n        }\n        String proxyAddress = System.getProperty(\"socks5Proxy.address\");\n        return Optional.ofNullable(proxyAddress).map(address -> {\n            try {\n                URI uri = URI.create(address);\n                return new InetSocketAddress(uri.getHost(), uri.getPort());\n            } catch (Exception e) {\n                throw new RuntimeException(\"Invalid config [socks5Proxy.address]\", e);\n            }\n        }).orElse(null);\n    }\n","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/conf/ClientConfigurationData.java#L588-L624","documentation":"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.","triggerScenarios":"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').","commonSituations":"Agent/bytecode-weaving tools or shaded builds interfering with class metadata; custom forks of Pulsar that altered the class hierarchy.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    ClientConfigurationData copy = conf.clone();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().equals(\"Failed to clone ClientConfigurationData\")) {\n        // bytecode/agent or shading issue; rebuild config manually\n    } else throw e;\n}","preventionTips":["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."],"tags":["clone","defensive","configuration","unreachable"],"backgroundTag":"clone-not-supported","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}