Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[BUG] PIT is not deleted when a Calcite query is rejected for memory at start

Aperta
#5,860 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
backend, search

Direzione di ricerca

Start in CalciteEnumerableIndexScan.enumerator(), where osIndex.buildRequest(...) runs as a constructor argument and creates the PIT before OpenSearchIndexEnumerator's constructor performs the memory check and may throw. Read that constructor and its close() method to see why the PIT is never deleted. Done means that a rejected query leaves no open PIT contexts, either because the memory check runs before buildRequest or because the PIT is deleted when the constructor throws, and a test covers that path.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug PPL
Issue Summary:

When a query is rejected with Insufficient resources to start query, the PIT it already created is never deleted. It stays open until plugins.sql.cursor.keep_alive (1m) expires.

In CalciteEnumerableIndexScan.enumerator(), osIndex.buildRequest(...) is passed as a constructor argument, so it runs first and creates the PIT. The OpenSearchIndexEnumerator constructor then fails its memory check and throws, so no enumerator exists and close() never runs to delete the PIT.

Steps to Reproduce:
  1. Index 200k docs into a 2-shard index.
  2. Bring heap above plugins.query.memory_limit (default 85%).
  3. Run a full-scan query 20 times, e.g. source=big | eval z=concat(s, cast(k as string)) | eventstats count() as c by g | sort - z | head 5.
  4. Check point_in_time_current in _nodes/stats/indices/search.

###Expected Result:
no open PIT contexts after the queries fail.

Actual Result:

every "start query" rejection leaves 2 open PIT contexts (one per shard) until they expire. Queries rejected mid-scan ("continue processing") don't leak, and neither do successful ones.

Impact:

under memory pressure, rejected queries pile up open PIT contexts toward search.max_open_pit_context (300). New queries can keep failing for up to a minute after memory recovers. Async submits make this easier to hit.

Suggested fix:

check the resource monitor before calling buildRequest, or delete the PIT if the constructor throws.

Env Setup - OpenSearch Version:

3.10.0-SNAPSHOT, main @ 866dafcbd

Lingua principale
Java
Stelle
175
Fork
233
Merge medio
2g 16h
PR unite (30g)
39

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di opensearch-project/sql

Tutte le issue di opensearch-project/sql

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.