-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Parallel indexing can corrupt the heap in the Haskell scanner #1231
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgesGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.securitySecurity vulnerabilities, hardeningSecurity vulnerabilities, hardeningstability/performanceServer crashes, OOM, hangs, high CPU/memoryServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UXDisplay bugs, docs, adoption UX
Milestone
Description
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgesGraph extraction bugs, false positives, missing edgespriority/highNeeds near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.Needs near-term maintainer attention; high-impact bug, regression, safety issue, or release blocker.securitySecurity vulnerabilities, hardeningSecurity vulnerabilities, hardeningstability/performanceServer crashes, OOM, hangs, high CPU/memoryServer crashes, OOM, hangs, high CPU/memoryux/behaviorDisplay bugs, docs, adoption UXDisplay bugs, docs, adoption UX
Version
codebase-memory-mcp dev at 5e7d3eb
Platform
Linux x64, built from source, UI variant, GCC 16.1.1
What happened
Indexing a mixed-language repository with two or more workers aborts with glibc heap-metadata corruption. One worker completes. Parallel indexing should complete without changing worker count or disabling concurrency.
Reproduction
Valgrind with the production O2 build reports the first invalid write in advance -> take_line -> newline_lookahead -> tree_sitter_haskell_external_scanner_scan. The write uses the old contents pointer immediately after realloc moved the Lookahead buffer. The pinned Haskell tree_sitter/array.h passes differently typed Array structs through Array(void) pointers, violating strict aliasing; Tree-sitter fixed this class upstream in tree-sitter/tree-sitter#5242.
Expected
The existing parallel worker count remains enabled and the repository indexes successfully.
Scale
10,138 nodes and roughly 50,800 edges in the isolated reproduction corpus.
Confirmations