{"record":{"id":"c570356aeb1108f9","repo":"apache/seatunnel","slug":"failed-to-close-file-system-proxy","errorCode":null,"errorMessage":"Failed to close {} file system proxy","messagePattern":"Failed to close (.+?) file system proxy","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java","lineNumber":755,"sourceCode":"                bom == null ? Charset.forName(encoding) : Charset.forName(bom.getCharsetName());\n        return new BufferedReader(new InputStreamReader(bomInputStream, charset));\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (targetHadoopFileSystemProxy != null && !shareTargetFileSystemProxy) {\n            closeFileSystemProxy(targetHadoopFileSystemProxy, \"target\");\n        }\n        if (hadoopFileSystemProxy != null) {\n            closeFileSystemProxy(hadoopFileSystemProxy, \"source\");\n        }\n    }\n\n    private void closeFileSystemProxy(HadoopFileSystemProxy proxy, String role) {\n        try {\n            proxy.close();\n        } catch (Exception e) {\n            log.warn(\"Failed to close {} file system proxy\", role, e);\n        }\n    }\n\n    private void validateUpdateSyncConfig(Config pluginConfig) {\n        if (!pluginConfig.hasPath(FileBaseSourceOptions.FILE_FORMAT_TYPE.key())) {\n            throw new FileConnectorException(\n                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,\n                    \"When sync_mode=update, file_format_type must be set.\");\n        }\n        FileFormat fileFormat =\n                FileFormat.valueOf(\n                        pluginConfig\n                                .getString(FileBaseSourceOptions.FILE_FORMAT_TYPE.key())\n                                .toUpperCase());\n        if (fileFormat != FileFormat.BINARY) {\n            throw new FileConnectorException(\n                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,\n                    \"sync_mode=update currently only supports file_format_type=binary.\");","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/AbstractReadStrategy.java#L737-L773","documentation":"A warning (not a thrown error) logged by closeFileSystemProxy in AbstractReadStrategy. When the reader shuts down it closes Hadoop FileSystem proxy objects; if proxy.close() throws any Exception, the failure is logged at WARN with the proxy's role (source/target) and execution continues — resources may leak but the job is not failed by this path.","triggerScenarios":"proxy.close() on a HadoopFileSystemProxy throws — typically because the underlying Hadoop FileSystem was already closed, was never fully initialized, or the close call itself hit an I/O error on the distributed filesystem.","commonSituations":"Job teardown after an earlier failure already closed filesystems; double-close of shared FileSystem instances; HDFS/S3 transient I/O errors during close; JVM shutdown races.","solutions":["Inspect the logged stack trace (the exception is passed as the last log argument) to identify the root close failure.","Avoid sharing/closing the same Hadoop FileSystem across multiple readers; let the proxy manage its lifecycle.","Ensure the filesystem (HDFS NameNode, S3 endpoint) is reachable at job teardown; transient close errors are usually safe to ignore.","If leaks recur, upgrade/align Hadoop client versions used by the connector."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    proxy.close();\n} catch (Exception e) {\n    log.warn(\"Failed to close {} file system proxy\", role, e);\n    // non-fatal at teardown; inspect stack trace if leaks recur\n}","preventionTips":["Don't share Hadoop FileSystem instances across independent reader lifecycles.","Verify filesystem reachability at job end if close warnings persist.","Align Hadoop client versions to avoid close()-time incompatibilities."],"tags":["hadoop","filesystem","resource-cleanup","logging"],"backgroundTag":"file-open-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}