Skip to content

Reassess 23 slow-parse files (1000-repo batch) with --splicing-speed/--file-speed; 2003s outlier breaks the 15s ReDoS failsafe guarantee #1095

Closed

Description

@squid-protocol

Summary

A recent 1000-repo batch scan surfaced 23 files that tripped the 🐌 SLOW PARSE DETECTED alert (gitgalaxy/galaxyscope.py, total_time > 10.0), 22 of which cluster tightly around the 15s signal.alarm(15) ReDoS failsafe (execution_timeout_failsafe, gitgalaxy/galaxyscope.py:88 / :337) — and one massive outlier that blew straight through it: scu_constants.h (freebsd-src) took 2003.00s (~33 minutes) on a file that should have been hard-capped at 15s.

I don't have the actual files locally (they came from a sparse-checkout report repo, gitgalaxy-raw-output, not this checkout), so this issue is a request to reassess these languages/files for slowness using galaxyscope's existing diagnostic modes (--splicing-speed for regex-level profiling, --file-speed for macro-phase profiling) rather than a pre-diagnosed fix.

Raw data (batch run, 2026-08-06)

🐌 Slow Files > 10s (23 files):
   - [darwin-xnu]     EXTERNAL_HEADERS/AvailabilityInternal.h (20.61s)
   - [circuitpython]  shared-module/usb_video/uvc_usb_descriptors.h (15.03s)
   - [Rocket.Chat]    development/tempo.yml (15.01s)
   - [grafana]        pkg/storage/unified/sql/rvmanager/data/resource_history_update_rv.sql (15.00s)
   - [grafana]        pkg/storage/unified/sql/rvmanager/data/resource_update_rv.sql (15.00s)
   - [fineract]       config/docker/tempo/etc/tempo.yml (15.00s)
   - [freebsd-src]    contrib/llvm-project/llvm/include/llvm/BinaryFormat/MachO.h (15.19s)
   - [freebsd-src]    sys/contrib/edk2/Include/Protocol/IdeControllerInit.h (15.05s)
   - [freebsd-src]    sys/dev/isci/scil/intel_sas.h (15.10s)
   - [freebsd-src]    sys/ofed/include/rdma/uverbs_ioctl.h (15.07s)
   - [freebsd-src]    sys/dev/isci/scil/scu_constants.h (2003.00s)   <-- outlier, see below
   - [micropython]    drivers/cc3100/inc/wlan_rx_filters.h (15.07s)
   - [roslyn]         src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenTupleTest.cs (11.27s)
   - [runtime]        src/libraries/System.Runtime.Intrinsics/ref/System.Runtime.Intrinsics.cs (17.47s)
   - [runtime]        src/libraries/System.Runtime/ref/System.Runtime.cs (20.33s)
   - [runtime]        src/tests/JIT/Directed/cmov/Bool_And_Op.cs (10.89s)
   - [runtime]        src/tests/JIT/Directed/cmov/Bool_Or_Op.cs (11.63s)
   - [runtime]        src/tests/JIT/Directed/cmov/Float_Xor_Op.cs (11.33s)
   - [runtime]        src/tests/JIT/Directed/cmov/Bool_Xor_Op.cs (13.55s)
   - [runtime]        src/tests/JIT/Directed/cmov/Int_Xor_Op.cs (10.65s)
   - [runtime]        src/tests/JIT/Directed/nullabletypes/isinst2.cs (10.67s)
   - [runtime]        src/tests/JIT/Directed/nullabletypes/isinstvaluetype.cs (11.85s)
   - [runtime]        src/tests/JIT/Regression/VS-ia64-JIT/V1.2-M01/b10827/MT_DEATH.cs (10.13s)

Grouped by language: C headers (7: darwin-xnu, circuitpython, freebsd-src x4, micropython), C# (8, all runtime/roslyn), YAML (2, both Grafana Tempo config, non-CI), SQL (2, grafana), plus the freebsd-src outlier (also C).

Why this deserves a closer look, not just "raise the timeout"

  1. scu_constants.h at 2003s despite a 15s fuse is the real red flag. The failsafe
    (gitgalaxy/galaxyscope.py:333-337) is a POSIX signal.alarm(15) wired to a handler that
    raises TimeoutError. Per Python's signal semantics, the handler only actually runs when
    control returns to the bytecode interpreter's eval loop — if the process is blocked inside a
    single native re C-level match call (classic near-catastrophic backtracking), the alarm can
    fire at the OS level but the Python-level exception won't be raised until that C call finally
    returns. A 2003s stall is consistent with the engine hitting exactly this gap: the "ReDoS-proof"
    claim held in the sense that it terminated, but the 15s budget it's supposed to guarantee was
    not enforced by ~2 orders of magnitude. This needs to be reproduced and root-caused, not
    papered over.
  2. The other 22 cluster suspiciously tight around 15.00-15.19s — consistent with the fuse
    doing its job and parser_bypass-ing the file, but that means these files never got
    structurally parsed at all in the batch run (see the "Unparsable (Structural Saturation / Global Regex Timeout)" status path at galaxyscope.py:595) — a real accuracy gap on top of
    the perf question. The handful above 15s (17-20s, .cs files at 20.33s/17.47s, AvailabilityInternal.h at 20.61s) suggest the pre-alarm phases (path resolution / disk I/O, which run before signal.alarm(15) is armed) or post-timeout bookkeeping are themselves non-trivial for these files, and are worth separating out via --file-speed's phase breakdown.
  3. C header files are likely hitting large flat token/macro tables (AvailabilityInternal.h,
    wlan_rx_filters.h, intel_sas.h, scu_constants.h are all classic huge #define/enum dump
    headers) — worth checking whether a c language rule (or a shared Mode-derived rule c inherits)
    has a quantifier that scales worse than linear against thousands of similarly-shaped
    consecutive lines, vs. this simply being large-file I/O + per-line overhead at scale.
  4. C# and yaml already went through dedicated hardening (epic #813 closed csharp's extraction gauntlet; epic #1069/#1071 put csharp in the strong _best_of_timing scaling-ratio ReDoS check cohort), so a fresh perf regression showing up in exactly those languages is notable — either these specific files exercise a shape the hardening didn't cover, or the slowness isn't in a per-signature regex at all but somewhere else in the pipeline (prism.py splitting, _slice_by_braces, dependency capture) that the strict-signature test suite doesn't exercise. Worth ruling in/out with --splicing-speed's regex-level telemetry before assuming it's a language_standards.py regex.
  5. The two tempo.yml files are plain application config YAML, not CI/CD YAML. Per
    [[extraction_hardening_epic_813]], yaml's _meta.target_version scopes its 4 extraction
    gauntlets specifically to GitHub Actions/GitLab CI shapes — these Tempo configs are a
    different YAML shape entirely, so any slowness here is likely orthogonal to that hardening
    work and needs separate investigation.

Ask

Reassess these files/languages for parsing slowness using galaxyscope's existing diagnostic
modes (no new tooling needed):

  • --splicing-speed — per-regex profiling (profile_regex/regex_telemetry, capped at 5000
    files) to identify which specific language_standards.py pattern(s) are the hot spot for the C
    header and C# cases.
  • --file-speed — macro-phase lifecycle profiling (disk I/O / language detection / lexical
    split / structural detection) to see whether the slowness is concentrated in one pipeline
    stage or spread across all of them, and to explain the >15s outliers that exceed the alarm
    window.
  • Specifically reproduce sys/dev/isci/scil/scu_constants.h from freebsd-src and confirm
    whether signal.alarm(15) actually bounds worst-case wall-clock time for a file shaped like it
    — if not, that's a correctness bug in the ReDoS failsafe itself (a 2003.00s observed stall
    against a 15s documented guarantee), independent of any regex fix.
  • If a specific regex is identified as sub-linear/pathological on these shapes (huge flat
    macro/constant tables for C, generated/repetitive test fixtures for C#), harden it following
    gitgalaxy/standards/how_to_add_a_language.md's ReDoS rules and add a pathological-tier
    regression case via the harden-language-extraction / harden-strict-signatures tooling
    (redos_scaling_check.py) so this doesn't silently regress again.

I don't have local copies of these files (sourced from a sparse-checkout report repo, not this
checkout) — reproduction will need pulling matching-shaped files from the actual upstream repos
(darwin-xnu, freebsd-src, micropython, circuitpython, dotnet/runtime, dotnet/roslyn, grafana,
Rocket.Chat, apache/fineract) or synthesizing a representative fixture of the same shape (e.g. a
large flat #define/enum table for the C header cases).

Activity

  1. added
    core-engine
    on Aug 6, 2026
  2. squid-protocol commented on Aug 13, 2026

    @squid-protocol
    OwnerAuthor

    now that we've updated the engine so much, we'll re run a batch scan against the 726 repos to determine what samples stick out now.

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

    core-engineperformance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions