Skip to main content

Crate gonzalo_parse

Crate gonzalo_parse 

Source
Expand description

Crash-isolated code parsing (ticket E).

tree-sitter grammars are C and can abort()/segfault on malformed input, which Rust cannot catch. ParserPool runs build_rust in a pool of gonzalo-parse-worker subprocesses, so such a crash kills only a worker; the pool respawns it and the graph store/query layer (in the parent) is never taken down. This is the isolation required before parsing arbitrary target-repo input at scale.

The pool keeps size long-lived workers and dispatches parses round-robin, one in flight per worker. A worker that dies (crash) or hangs past the per-parse timeout is dropped and lazily respawned on next use; a death is retried once on a fresh worker so an unlucky crash doesn’t fail a good parse.

Structs§

ParseRequest
One parse request sent to a worker: the source and the language to parse it as. Serialized as one JSON line (JSON escapes newlines, so a whole file is a single line).
ParserPool
A pool of parse-worker subprocesses.

Enums§

ParseError
Why a parse did not return a graph. All variants are recoverable — the pool has already dropped the offending worker.