{"record":{"id":"5c120aad3eb0e0bb","repo":"apache/seatunnel","slug":"close-easysearch-connection-error","errorCode":null,"errorMessage":"close easysearch connection error","messagePattern":"close easysearch connection error","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java","lineNumber":292,"sourceCode":"                    .clusterVersion(versionNode.get(\"number\").asText())\n                    .distribution(\n                            Optional.ofNullable(versionNode.get(\"distribution\"))\n                                    .map(e -> e.asText())\n                                    .orElse(null))\n                    .build();\n        } catch (IOException e) {\n            throw new EasysearchConnectorException(\n                    EasysearchConnectorErrorCode.GET_EZS_VERSION_FAILED,\n                    \"fail to get easysearch version.\",\n                    e);\n        }\n    }\n\n    public void close() {\n        try {\n            restClient.close();\n        } catch (IOException e) {\n            log.warn(\"close easysearch connection error\", e);\n        }\n    }\n\n    public boolean clearScroll(String scrollId) {\n        if (scrollId == null || scrollId.isEmpty()) {\n            return false;\n        }\n\n        String endpoint = \"/_search/scroll\";\n        Request request = new Request(\"DELETE\", endpoint);\n        Map<String, String> param = new HashMap<>();\n        param.put(\"scroll_id\", scrollId);\n        request.setJsonEntity(JsonUtils.toJsonString(param));\n\n        try {\n            Response response = restClient.performRequest(request);\n            if (response == null) {\n                log.warn(\"DELETE {} response null when clearing scrollId {}\", endpoint, scrollId);","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java#L274-L310","documentation":"EasysearchClient.close attempts to close the low-level Elasticsearch RestClient and logs this warning if the close throws an IOException. This is a cleanup-only failure: the client's work is done, the underlying HTTP connection just could not be released gracefully.","triggerScenarios":"restClient.close() throws IOException — typically because the underlying HTTP connection is already broken, the Easysearch/Elasticsearch node dropped the TCP connection, or close is called twice with a stale client.","commonSituations":"Source job finishing while the Easysearch node was restarted; idle keep-alive connections closed by a firewall/LB before the client close; long-running batch reads hitting connection idle timeouts.","solutions":["Safe to ignore in most cases — it is a release-time warning; verify no data was lost","Set keep-alive/idle timeout on the RestClient below the firewall idle timeout","Check Easysearch server logs for abrupt connection closes","Ensure close() is only called once per client instance"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Close only an open, non-closed client\nif (client == null) return;\n// Optionally probe: RequestOptions.builder().setSocketTimeout(1000) health ping before close","typeGuard":"boolean isClosed(RestClient c) { try { c.performRequest(new Request(\"GET\", \"/\")); return false; } catch (ResponseException e) { return false; } catch (IOException e) { return true; } }","tryCatchPattern":"try { easysearchClient.close(); } catch (Exception e) { log.warn(\"ignoring easysearch client close failure\", e); } // release-time only","preventionTips":["Call close() exactly once per client lifecycle","Set RestClient keep-alive below network idle timeouts","Ignore close-time IOExceptions as non-fatal cleanup noise"],"tags":["easysearch","rest-client","connection-close","cleanup"],"backgroundTag":"broken-pipe","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}