A deeply nested query crashes the whole process with `fatal error: stack overflow`

Aperta
#47 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Start at the query evaluation path and reproduce the issue with a descendant filter repeated about 200 times against a document nested roughly 7,500 arrays deep; parsing succeeds, and evaluation crashes with a stack overflow. Trace the recursive evaluation involved and compare how the project reports errors for invalid queries. Done means deeply nested input returns a catchable error instead of aborting the process.

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

Descrizione

Evaluating a very deeply nested descendant-filter query against a deeply nested document overflows the goroutine stack,
and the Go runtime aborts the entire process with fatal error: stack overflow. It's a fatal runtime error, not a
panic, so recover() can't catch it — anything evaluating user-supplied queries can be taken down by one query.

The query is a descendant filter repeated a few hundred times — roughly $..[?@.*&&[email protected]||@.b|| ... ] about 200 times
over — run against a document that's a few thousand nested empty arrays ([[[ ... ]]]). Parsing succeeds; the crash
happens during evaluation. It aborts consistently at around 200 filter levels over a document about 7500 deep.

For comparison, jsonpath-rust stops at a nesting depth of 128 and jsonpath-rfc9535 raises an error you can catch,
rather than crashing.

Lingua principale
Go
Stelle
41
Fork
4
Merge medio
2g 8h
PR unite (30g)
3

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 theory/jsonpath

Tutte le issue di theory/jsonpath

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.