apache/seatunnel · warning

close easysearch connection error

Error message

close easysearch connection error

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/client/EasysearchClient.java:292

                    .clusterVersion(versionNode.get("number").asText())
                    .distribution(
                            Optional.ofNullable(versionNode.get("distribution"))
                                    .map(e -> e.asText())
                                    .orElse(null))
                    .build();
        } catch (IOException e) {
            throw new EasysearchConnectorException(
                    EasysearchConnectorErrorCode.GET_EZS_VERSION_FAILED,
                    "fail to get easysearch version.",
                    e);
        }
    }

    public void close() {
        try {
            restClient.close();
        } catch (IOException e) {
            log.warn("close easysearch connection error", e);
        }
    }

    public boolean clearScroll(String scrollId) {
        if (scrollId == null || scrollId.isEmpty()) {
            return false;
        }

        String endpoint = "/_search/scroll";
        Request request = new Request("DELETE", endpoint);
        Map<String, String> param = new HashMap<>();
        param.put("scroll_id", scrollId);
        request.setJsonEntity(JsonUtils.toJsonString(param));

        try {
            Response response = restClient.performRequest(request);
            if (response == null) {
                log.warn("DELETE {} response null when clearing scrollId {}", endpoint, scrollId);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Safe to ignore in most cases — it is a release-time warning; verify no data was lost
  2. Set keep-alive/idle timeout on the RestClient below the firewall idle timeout
  3. Check Easysearch server logs for abrupt connection closes
  4. Ensure close() is only called once per client instance
Defensive patterns

Strategy: try-catch

Validate before calling

// Close only an open, non-closed client
if (client == null) return;
// Optionally probe: RequestOptions.builder().setSocketTimeout(1000) health ping before close

Type guard

boolean isClosed(RestClient c) { try { c.performRequest(new Request("GET", "/")); return false; } catch (ResponseException e) { return false; } catch (IOException e) { return true; } }

Try / catch

try { easysearchClient.close(); } catch (Exception e) { log.warn("ignoring easysearch client close failure", e); } // release-time only

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/5c120aad3eb0e0bb. Report an issue: GitHub.