{"record":{"id":"d38558f58217eb6d","repo":"apache/pulsar","slug":"e-getmessage-d38558","errorCode":null,"errorMessage":"${e.getMessage()}","messagePattern":"\\$\\{e\\.getMessage\\(\\)\\}","errorType":"exception","errorClass":"org.apache.pulsar.client.impl.v5.PulsarClientException","httpStatus":null,"severity":"error","filePath":"pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientV5.java","lineNumber":106,"sourceCode":"            throw new PulsarClientException(\"Interrupted while creating transaction\", e);\n        }\n    }\n\n    @Override\n    public CompletableFuture<Transaction> newTransactionAsync() {\n        var builder = v4Client.newTransaction();\n        if (transactionTimeout != null) {\n            builder.withTransactionTimeout(transactionTimeout.toMillis(), TimeUnit.MILLISECONDS);\n        }\n        return builder.build().thenApply(v4Txn -> (Transaction) new TransactionV5(v4Txn));\n    }\n\n    @Override\n    public void close() throws PulsarClientException {\n        try {\n            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    }","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client-v5/src/main/java/org/apache/pulsar/client/impl/v5/PulsarClientV5.java#L88-L124","documentation":"The synchronous close() delegates to the wrapped v4 client's close(); if the v4 client throws org.apache.pulsar.client.api.PulsarClientException, it is re-thrown as this module's PulsarClientException with the original message and cause. It means graceful shutdown of the client (closing producers/consumers and releasing connections) failed — often due to I/O or already-closed state.","triggerScenarios":"Calling PulsarClientV5.close() when the underlying client fails to shut down cleanly — network errors while closing producers/consumers, or the client was already closed earlier in the lifecycle.","commonSituations":"Double-close in application cleanup paths (try-with-resources plus manual close); network partitions during shutdown; lingering producers that fail to unsubscribe/close within the close timeout.","solutions":["Inspect the wrapped cause for the underlying close failure","Make cleanup idempotent: track whether the client was already closed to avoid double-close","If the cause is network-related, consider calling shutdown() for a forced non-graceful teardown instead"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (clientClosed) return; // guard with your own lifecycle flag","typeGuard":null,"tryCatchPattern":"try {\n    client.close();\n} catch (PulsarClientException e) {\n    log.warn(\"Client close failed: {}\", e.getMessage(), e.getCause());\n}","preventionTips":["Close the client exactly once; use try-with-resources or a closed flag","Treat close failures as non-fatal in shutdown paths; log and continue teardown","If graceful close fails due to network, fall back to shutdown()"],"tags":["lifecycle","close","client"],"backgroundTag":"client-close-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"}