apache/seatunnel · warning

Failed to delete Point-in-Time with ID: {}

Error message

Failed to delete Point-in-Time with ID: {}

What it means

A WARN log from ElasticsearchSourceReader.searchWithPointInTime: deleting the Point-in-Time (PIT) search context (DELETE /_pit) failed after reading. Data is unaffected; the PIT context remains open on Elasticsearch until it times out, holding file descriptors/segments open. pitOwnedByReader guards that only the owner deletes it.

Source

Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/source/ElasticsearchSourceReader.java:259

                                sourceIndexInfo.getSource(),
                                sourceIndexInfo.getQuery(),
                                sourceIndexInfo.getPitBatchSize(),
                                sourceIndexInfo.getSearchAfter(),
                                sourceIndexInfo.getPitKeepAlive(),
                                sourceIndexInfo.getRuntimeFields(),
                                sourceIndexInfo.getSliceId(),
                                sourceIndexInfo.getSliceMax());

                // Output the results
                outputFromPitResult(pitResult, sourceIndexInfo, output, deserializer);
            }
        } finally {
            // Always clean up the PIT when done
            if (pitOwnedByReader && pitId != null) {
                try {
                    esRestClient.deletePointInTime(pitId);
                } catch (Exception e) {
                    log.warn("Failed to delete Point-in-Time with ID: {}", pitId, e);
                }
            }
        }
    }

    private void outputFromScrollResult(
            ScrollResult scrollResult,
            ElasticsearchConfig elasticsearchConfig,
            Collector<SeaTunnelRow> output,
            SeaTunnelRowDeserializer deserializer) {
        List<String> source = elasticsearchConfig.getSource();
        String tableId = elasticsearchConfig.getCatalogTable().getTablePath().toString();
        for (Map<String, Object> doc : scrollResult.getDocs()) {
            SeaTunnelRow seaTunnelRow =
                    deserializer.deserialize(new ElasticsearchRecord(doc, source, tableId));
            output.collect(seaTunnelRow);
        }
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Increase the PIT keep_alive in the source config so it outlives the read
  2. Confirm network/auth to Elasticsearch and cluster stability for the job duration
  3. If PITs accumulate, close stale ones manually: DELETE /_pit {"id":"<logged pitId>"}
  4. Check pitOwnedByReader logic when sharing PITs across reader subtasks
Defensive patterns

Strategy: try-catch

Validate before calling

// confirm PIT endpoint available and auth valid
// curl -X POST 'https://es-host:9200/<index>/_pit?keep_alive=10m'

Try / catch

// non-fatal; if PITs leak, close manually:
// curl -X DELETE 'https://es-host:9200/_pit' -H 'Content-Type: application/json' -d '{"id":"<pitId from log>"}'

Prevention

When it happens

Trigger: scrollSearchResult -> searchWithPointInTime completes and finally calls esRestClient.deletePointInTime(pitId); the call fails due to network error, node restart, the PIT already expiring (keep_alive exceeded), or ES rejecting the unknown pit_id.

Common situations: Long batch reads exceeding the PIT keep_alive; Elasticsearch cluster rolling restart mid-job; running multiple readers where PIT sharing/ownership is misconfigured; auth changes between PIT creation and deletion.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


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