{"record":{"id":"0f1b474e44a2d364","repo":"apache/seatunnel","slug":"failed-to-close-pulsar-admin","errorCode":null,"errorMessage":"Failed to close Pulsar admin.","messagePattern":"Failed to close Pulsar admin\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java","lineNumber":279,"sourceCode":"        if (noMoreNewPartitionSplits && boundedness == Boundedness.BOUNDED) {\n            LOG.debug(\n                    \"No more PulsarPartitionSplits to assign. Sending NoMoreSplitsEvent to reader {}.\",\n                    pendingReaders);\n            pendingReaders.forEach(context::signalNoMoreSplits);\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (executor != null) {\n            // Stop periodic discovery before closing the shared admin client it uses.\n            executor.shutdownNow();\n        }\n        if (pulsarAdmin != null) {\n            try {\n                PulsarConfigUtil.runWithConnectorClassLoader(pulsarAdmin::close);\n            } catch (Exception e) {\n                throw new IOException(\"Failed to close Pulsar admin.\", e);\n            }\n        }\n    }\n\n    @Override\n    public void addSplitsBack(List<PulsarPartitionSplit> splits, int subtaskId) {\n        addPartitionSplitChangeToPendingAssignments(splits);\n\n        // If the failed subtask has already restarted, we need to assign pending splits to it\n        if (context.registeredReaders().contains(subtaskId)) {\n            assignPendingPartitionSplits(Collections.singleton(subtaskId));\n        }\n    }\n\n    @Override\n    public int currentUnassignedSplitSize() {\n        return pendingPartitionSplits.size();\n    }","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-pulsar/src/main/java/org/apache/seatunnel/connectors/seatunnel/pulsar/source/enumerator/PulsarSplitEnumerator.java#L261-L297","documentation":"PulsarSplitEnumerator.close shuts down its executor and closes the PulsarAdmin client. If pulsarAdmin.close() (run under the connector classloader) throws, the IOException is wrapped as 'Failed to close Pulsar admin.' This is a cleanup-path error: the job/task was stopping but the admin client could not be released cleanly.","triggerScenarios":"Calling PulsarSplitEnumerator.close() while the PulsarAdmin client's underlying connection is broken, the admin service is unreachable, or the close call is interrupted/fails inside PulsarConfigUtil.runWithConnectorClassLoader.","commonSituations":"Job cancellation during a Pulsar broker/admin outage; network partitions between SeaTunnel workers and the Pulsar admin service; classloader issues in plugin deployments.","solutions":["Check connectivity to the Pulsar admin service URL; this error usually reflects an already-broken connection.","Inspect the wrapped cause (PulsarAdminException) for the real reason (timeout, auth, connection reset).","If it appears only at shutdown after a normal job completion, it is largely benign — resources are released on process teardown anyway.","Ensure firewall/idle-timeout settings don't kill long-lived admin connections mid-job; tune keepalive."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"checkAdminServiceReachable(cfg.getString(\"admin.service-url\")); // HTTP HEAD before job start","typeGuard":null,"tryCatchPattern":"try {\n    enumerator.close();\n} catch (IOException e) {\n    LOG.warn(\"Pulsar admin close failed at shutdown; cause: {}\", e.getCause(), e);\n}","preventionTips":["Verify admin.service-url reachability before starting jobs.","Treat close-time failures after normal completion as benign warnings.","Check firewall/idle timeouts that sever long-lived admin connections."],"tags":["pulsar","cleanup","admin-client","shutdown"],"backgroundTag":"network-request-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}