{"record":{"id":"401b73c755116472","repo":"apache/seatunnel","slug":"close-elasticsearch-connection-error","errorCode":null,"errorMessage":"close elasticsearch connection error","messagePattern":"close elasticsearch connection error","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java","lineNumber":185,"sourceCode":"                    .distribution(\n                            Optional.ofNullable(versionNode.get(\"distribution\"))\n                                    .map(JsonNode::asText)\n                                    .orElse(null))\n                    .build();\n        } catch (IOException e) {\n            throw new ElasticsearchConnectorException(\n                    ElasticsearchConnectorErrorCode.GET_ES_VERSION_FAILED,\n                    \"fail to get elasticsearch version.\",\n                    e);\n        }\n    }\n\n    @Override\n    public void close() {\n        try {\n            restClient.close();\n        } catch (IOException e) {\n            log.warn(\"close elasticsearch connection error\", e);\n        }\n    }\n\n    /**\n     * first time to request search documents by scroll call /${index}/_search?scroll=${scroll}\n     *\n     * @param index index name\n     * @param source select fields\n     * @param scrollTime such as:1m\n     * @param scrollSize fetch documents count in one request\n     */\n    public ScrollResult searchByScroll(\n            String index,\n            List<String> source,\n            Map<String, Object> query,\n            String scrollTime,\n            int scrollSize) {\n        return searchByScroll(index, source, query, scrollTime, scrollSize, null, null, null);","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java#L167-L203","documentation":"EsRestClient.close closes the shared low-level Elasticsearch RestClient; if restClient.close() throws an IOException, this warning is logged and the exception is swallowed. It is a connection-release failure only — reads/writes already completed — so it does not fail the job.","triggerScenarios":"Calling close() (via getOrCreateClientResource teardown or initializeStandaloneClient cleanup) while the underlying HTTP connection is dead, reset by the peer, or already half-closed.","commonSituations":"Elasticsearch node restart or cluster rebalance during job teardown; idle connection killed by LB/firewall before close; TLS handshake failure on the final close; reusing a client after previous IO errors.","solutions":["Safe to ignore for correctness — confirm the job's data operations succeeded","Lower RestClient keep-alive interval below intermediary idle timeouts","Check Elasticsearch logs for connection resets at that timestamp","Ensure the client isn't closed twice or used after close"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (restClient == null) return; // nothing to close\n// Optionally: GET / on the cluster to confirm liveness before close (diagnostic only)","typeGuard":null,"tryCatchPattern":"try { esRestClient.close(); } catch (Exception e) { log.warn(\"ignoring elasticsearch client close failure\", e); }","preventionTips":["Close each shared client once (guard getOrCreateClientResource teardown against double-close)","Set keep-alive under LB/firewall idle timeouts","Treat close-time IOExceptions as non-fatal"],"tags":["elasticsearch","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"}