Skip to content

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

Description

@BobbieBarker

src/pipeline/pipeline_internal.h:26

/* Maximum byte budget for tree-sitter extraction per file */
#define CBM_EXTRACT_BUDGET 5000000

It is not a byte budget. It is passed as the timeout_micros argument at eight
call sites (pass_calls.c:779, pass_definitions.c:675 and :834,
pass_k8s.c:655 and :673, pass_parallel.c:1167, pass_semantic.c:667,
pass_usages.c:356), and internal/cbm/cbm.h:734 documents that parameter as:

// timeout_micros: per-file parse timeout in microseconds (0 = no timeout).

So the value is 5 seconds of CPU time. internal/cbm/cbm.c:2167 confirms it:

budget.cpu_deadline_ns = cbm_thread_cpu_time_ns() + budget_ns;
budget.wall_ceiling_ns = t0 + budget_ns * CBM_PARSE_WALL_CEILING_FACTOR;

and internal/cbm/cbm.c:299 already names it correctly:

#define CBM_PARSE_WALL_CEILING_FACTOR 12ULL /* ~60 s ceiling for the 5 s CPU budget */

So the header comment is just wrong. Renaming the constant is a wider change, but the comment can be corrected on its own.

Line numbers are against 5958f546.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    parsing/qualityGraph extraction bugs, false positives, missing edgesstability/performanceServer crashes, OOM, hangs, high CPU/memory

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions