{"record":{"id":"f3fd6184b1c6a0f8","repo":"apache/seatunnel","slug":"failed-to-clear-scroll-id-scrollid-f3fd61","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/source/ElasticsearchSourceReader.java","lineNumber":165,"sourceCode":"                                    sourceIndexInfo.getSliceId(),\n                                    sourceIndexInfo.getSliceMax());\n                    scrollId = scrollResult.getScrollId();\n\n                    outputFromScrollResult(scrollResult, sourceIndexInfo, output, deserializer);\n                    while (scrollResult.getDocs() != null && !scrollResult.getDocs().isEmpty()) {\n                        scrollResult =\n                                esRestClient.searchWithScrollId(\n                                        scrollResult.getScrollId(),\n                                        sourceIndexInfo.getScrollTime());\n                        scrollId = scrollResult.getScrollId();\n                        outputFromScrollResult(scrollResult, sourceIndexInfo, output, deserializer);\n                    }\n                } finally {\n                    if (StringUtils.isNotEmpty(scrollId)) {\n                        try {\n                            esRestClient.clearScroll(scrollId);\n                        } catch (Exception e) {\n                            log.warn(\"Failed to clear scroll ID: \" + scrollId, e);\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private void logSliceInfo(ElasticsearchConfig sourceIndexInfo) {\n        if (sourceIndexInfo.getSliceMax() > 1) {\n            log.info(\n                    \"Elasticsearch slicing enabled. index={}, slice_id={}, slice_max={}\",\n                    sourceIndexInfo.getIndex(),\n                    sourceIndexInfo.getSliceId(),\n                    sourceIndexInfo.getSliceMax());\n        }\n    }\n\n    /**","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/source/ElasticsearchSourceReader.java#L147-L183","documentation":"A WARN log from ElasticsearchSourceReader.scrollSearchResult: after finishing scroll-based pagination, clearing the scroll context (DELETE /_search/scroll with the scroll ID) failed. Data reading succeeded; the scroll context stays alive on the ES cluster until scroll timeout, consuming heap. The scroll ID is included so it can be cleared manually.","triggerScenarios":"pollNext -> scrollSearchResult loop finishes, finally block calls esRestClient.clearScroll(scrollId), which throws due to network error, cluster node restart, scroll context already expired/timed out, or ES returning an error for an unknown scroll_id.","commonSituations":"Long-running reads where the scroll timeout (e.g. 5m) elapsed before the final clear; ES cluster failover losing scroll state; transient HTTP failures; too many open scroll contexts on the cluster (max_open_scroll_context exceeded).","solutions":["Increase the scroll keep-alive (e.g. scroll=10m in config) so the context survives to the final clear","Verify ES cluster health and network stability during large scroll reads","Manually clear the logged scroll ID: DELETE /_search/scroll {\"scroll_id\":\"...\"}","If the cluster hits max_open_scroll_context, reduce concurrent SeaTunnel source parallelism or scroll usage"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure cluster reachable before job\ncurl -s \"https://es-host:9200/_cluster/health?wait_for_status=yellow&timeout=10s\"","typeGuard":null,"tryCatchPattern":"// library swallows the exception; operator-side retry:\n// curl -X DELETE 'https://es-host:9200/_search/scroll' -H 'Content-Type: application/json' -d '{\"scroll_id\":\"<id from log>\"}'","preventionTips":["Increase scroll timeout in source config so contexts outlive the read","Reduce concurrent scroll readers to stay under max_open_scroll_context","Clear logged scroll IDs manually when the warn appears"],"tags":["elasticsearch","scroll","cleanup"],"backgroundTag":"http-error-response","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"}