Skip to content

docs(pipeline): CBM_EXTRACT_BUDGET is a CPU-time parse budget, not bytes (#2311) - #2358

Open
DeusData wants to merge 1 commit into
mainfrom
fix/issue-2311
Open

DeusData wants to merge 1 commit into
mainfrom
fix/issue-2311

Conversation

@DeusData

Copy link
Copy Markdown
Owner

CBM_EXTRACT_BUDGET was described as a "maximum byte budget", but every call site passes it as cbm_extract_file*()'s timeout_micros: a per-file tree-sitter parse budget in microseconds of the parsing thread's CPU time (5 s), with a 12× wall-clock backstop (cbm.c). This corrects that comment and the timeout_micros description in internal/cbm/cbm.h, and moves the latter back onto cbm_extract_file().

Comments only; no behaviour or value change. make -f Makefile.cbm lint-ci passes. The optional rename of the constant is left out to keep the change small.

Thanks to @BobbieBarker for the report.

Fixes #2311

…tes (#2311)

The comment on CBM_EXTRACT_BUDGET called it a "maximum byte budget", but
every call site passes it as cbm_extract_file*()'s timeout_micros, which
cbm.c converts to nanoseconds and uses as a per-thread CPU-time deadline
(5 s) with a 12x wall-clock ceiling as a backstop for a stuck parse. No
code path uses the value with the wrong unit; only the documentation was
wrong.

Correct the constant's comment, and bring the timeout_micros description
in cbm.h up to date (CPU time + wall backstop, not a plain timeout) and
back onto cbm_extract_file(), from which later additions had separated it.

No behavior change; the budget value is unchanged.

Reported-by: BobbieBarker
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CBM_EXTRACT_BUDGET is documented as a byte budget but is passed as a parse timeout

1 participant