{"record":{"id":"93d3f62cb1f37f8d","repo":"apache/seatunnel","slug":"failed-to-clear-scroll-id-scrollid","errorCode":null,"errorMessage":"Failed to clear scroll ID: ${scrollId}","messagePattern":"Failed to clear scroll ID: (.+?)","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":343,"sourceCode":"                log.warn(\"DELETE {} response null for scroll ID: {}\", endpoint, scrollId);\n                return false;\n            }\n            String entity = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);\n            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {\n                JsonNode jsonNode = JsonUtils.parseObject(entity);\n                boolean succeeded = jsonNode.get(\"succeeded\").asBoolean();\n                return succeeded;\n            } else {\n                log.warn(\n                        \"DELETE {} response status code={}, body={} for scroll ID: {}\",\n                        endpoint,\n                        response.getStatusLine().getStatusCode(),\n                        entity,\n                        scrollId);\n                return false;\n            }\n        } catch (Exception ex) {\n            log.warn(\"Failed to clear scroll ID: \" + scrollId, ex);\n            return false;\n        }\n    }\n\n    /**\n     * Close SQL cursor to release server-side resources.\n     *\n     * @param cursor The SQL cursor to close\n     * @return True if the cursor was successfully closed\n     */\n    public boolean closeSqlCursor(String cursor) {\n        if (StringUtils.isEmpty(cursor)) {\n            log.debug(\"SQL cursor is empty; skip closing.\");\n            return false;\n        }\n\n        String endpoint = \"/_sql/close\";\n        Request request = new Request(\"POST\", endpoint);","sourceCodeStart":325,"sourceCodeEnd":361,"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#L325-L361","documentation":"clearScroll's catch-all: any Exception during the DELETE /_search/scroll exchange (ConnectException, SocketTimeout, response parsing failure, EntityUtils IO error) is logged with the scrollId and the method returns false. Cleanup failure is deliberately non-fatal — the scroll will still expire via its TTL.","triggerScenarios":"Network failure, connection reset, timeout, or JSON/entity parse error while performing or reading the DELETE /_search/scroll response.","commonSituations":"Elasticsearch unreachable mid-job (network partition, node restart); scroll clear fired during shutdown while the client connection is already closed; malformed server response from a proxy/gateway (e.g. HTML error page).","solutions":["Confirm the cluster is reachable at cleanup time; check proxies/firewalls between SeaTunnel and ES","Bound scroll TTL on the initial search so uncleaned scrolls expire anyway (cleanup is best-effort)","If clearing during close, ensure the RestClient is still open before calling clearScroll (order teardown correctly)","Retry once on transient IO errors; clearing is idempotent","Inspect the logged exception stack to distinguish transport vs parse errors"],"exampleFix":"// before: clear scroll after closing the client\nesClient.close();\nesClient.clearScroll(scrollId);\n// after: clear while client is still usable\nesClient.clearScroll(scrollId);\nesClient.close();","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// one retry, then give up gracefully — scroll expires via TTL\nif (!esClient.clearScroll(scrollId)) {\n    Thread.sleep(1000);\n    esClient.clearScroll(scrollId); // idempotent best-effort\n}","preventionTips":["Order teardown: clear scrolls before closing the RestClient","Bound scroll TTL so failed cleanups self-heal","Monitor ES cluster reachability during job shutdown","Log-and-continue: never fail a pipeline over scroll cleanup"],"tags":["elasticsearch","scroll","network","cleanup"],"backgroundTag":"network-request-failed","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"}