{"record":{"id":"a83b53e8e230ea13","repo":"apache/seatunnel","slug":"error-while-closing-resource","errorCode":null,"errorMessage":"Error while closing resource: {}","messagePattern":"Error while closing resource: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/util/DatabendUtil.java","lineNumber":340,"sourceCode":"\n        List<String> columns = new ArrayList<>();\n        try (PreparedStatement statement = connection.prepareStatement(sql.toString());\n                ResultSet resultSet = statement.executeQuery()) {\n            while (resultSet.next()) {\n                columns.add(resultSet.getString(\"column_name\"));\n            }\n        }\n        return columns;\n    }\n\n    /** Close resources quietly */\n    public static void closeQuietly(AutoCloseable... closeables) {\n        for (AutoCloseable closeable : closeables) {\n            if (closeable != null) {\n                try {\n                    closeable.close();\n                } catch (Exception e) {\n                    log.warn(\"Error while closing resource: {}\", e.getMessage());\n                }\n            }\n        }\n    }\n}\n","sourceCodeStart":322,"sourceCodeEnd":346,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/util/DatabendUtil.java#L322-L346","documentation":"closeQuietly is a utility that closes AutoCloseable resources (connections, statements, result sets) and deliberately swallows exceptions, logging them at WARN level. This message means a resource failed to close cleanly during cleanup. It is never fatal to the pipeline; it only indicates a cleanup issue, often masking an underlying problem.","triggerScenarios":"Any call to DatabentUtil.closeQuietly where closeable.close() throws — e.g. closing an already-closed connection, a socket broken by network loss, or a driver throwing on close after a prior error.","commonSituations":"Job teardown after an upstream failure; DB connection reset by peer; driver-specific close errors; double-close in error paths.","solutions":["Read the logged exception message to find which resource failed and why.","Check DB/network health if the message indicates connection resets.","Avoid double-closing resources in your own code paths that feed closeQuietly.","If noise is frequent, upgrade the Databend JDBC driver; some drivers fix close-after-failure behavior."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"if (resource instanceof AutoCloseable) { /* pass to closeQuietly */ }","tryCatchPattern":"try {\n    doWork();\n} finally {\n    DatabendUtil.closeQuietly(resultSet, statement, connection); // exceptions logged, not thrown\n}\n// check logs for \"Error while closing resource\" to diagnose underlying connection issues","preventionTips":["Always pass closeQuietly resources in finally blocks rather than manual close().","Monitor WARN logs for repeated close failures indicating network/DB instability.","Avoid reusing resources after closing them.","Upgrade JDBC drivers that throw on close-after-failure."],"tags":["resource-cleanup","jdbc","close","suppressed-exception"],"backgroundTag":"broken-pipe","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"}