{"record":{"id":"5e048d83cd9854d4","repo":"apache/pulsar","slug":"e-5e048d","errorCode":null,"errorMessage":"${e}","messagePattern":"\\$\\{e\\}","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"warning","filePath":"pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientV5.java","lineNumber":122,"sourceCode":"            v4Client.close();\n        } catch (org.apache.pulsar.client.api.PulsarClientException e) {\n            throw new PulsarClientException(e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public CompletableFuture<Void> closeAsync() {\n        return v4Client.closeAsync().exceptionally(ex -> {\n            throw new CompletionException(new PulsarClientException(ex.getMessage(), ex));\n        });\n    }\n\n    @Override\n    public void shutdown() {\n        try {\n            v4Client.shutdown();\n        } catch (org.apache.pulsar.client.api.PulsarClientException e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n","sourceCodeStart":104,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientV5.java#L104-L126","documentation":"shutdown() performs a forced, non-graceful teardown by delegating to the v4 client's shutdown(); if that throws org.apache.pulsar.client.api.PulsarClientException, it is wrapped in a plain java.lang.RuntimeException whose message is the exception's toString (the class name plus message). This signals the shutdown path itself failed and the JVM-level cleanup did not complete cleanly.","triggerScenarios":"Calling PulsarClientV5.shutdown() when the underlying v4 client's shutdown throws — e.g. I/O failures closing connections, or internal state indicating the client is already shut down.","commonSituations":"Shutdown hooks / JVM exit paths calling shutdown() during a network outage; calling shutdown() after close() (double teardown); container termination sequences where the broker is already gone.","solutions":["Read the wrapped RuntimeException's cause (the PulsarClientException) for the root failure","Reorder lifecycle: call shutdown() only once and only after producers/consumers are stopped","If the cause is benign (already closed), guard the call with a closed flag or catch-and-log"],"exampleFix":"// before\nclient.shutdown(); // raw RuntimeException on failure\n// after\ntry {\n    client.shutdown();\n} catch (RuntimeException e) {\n    log.warn(\"Shutdown failed\", e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"if (clientShutdown) return; // guard with your own lifecycle flag","typeGuard":null,"tryCatchPattern":"try {\n    client.shutdown();\n} catch (RuntimeException e) {\n    log.warn(\"Shutdown failed: {}\", e.getCause());\n}","preventionTips":["Call shutdown() once, after all producers/consumers are stopped","Never call shutdown() after close() on the same client","In JVM shutdown hooks, catch-and-log RuntimeException from shutdown rather than crashing"],"tags":["lifecycle","shutdown","unchecked-exception"],"backgroundTag":"client-shutdown-failed","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"}