Skip to content

fix: pin tree-sitter below 0.26.0 to fix segfault - #315

Open
namelessnotion wants to merge 2 commits into
Davidyz:mainfrom
namelessnotion:fix/tree-sitter-seg-fault
Open

fix: pin tree-sitter below 0.26.0 to fix segfault#315
namelessnotion wants to merge 2 commits into
Davidyz:mainfrom
namelessnotion:fix/tree-sitter-seg-fault

Conversation

@namelessnotion

Copy link
Copy Markdown

tree-sitter 0.26.0 reimplemented Point as a native tuple subclass (replacing the namedtuple), and that reimplementation has a memory safety bug that corrupts the heap when Point objects are repeatedly constructed/discarded, as chunking.py and query/init.py do. The corruption doesn't crash immediately, so make test segfaulted at different, seemingly unrelated tests across runs. I observed similar behavior when running vectorcode vectorise, segfaulting at different times. Pinning tree-sitter >=0.25.1,<0.26.0 eliminates the crash.

Also widen the exception handling in chunking.py's parser lookup to catch tree_sitter_language_pack's own Error hierarchy, not just LookupError: the currently locked tree_sitter_language_pack (1.14.3) raises DownloadError for an unrecognized language instead of the LookupError it used to raise, and normalize the re-raised exception back to LookupError so callers keep the same contract.

tree-sitter 0.26.0 reimplemented Point as a native tuple subclass
(replacing the namedtuple), and that reimplementation has a memory
safety bug that corrupts the heap when Point objects are repeatedly
constructed/discarded, as chunking.py and query/__init__.py do. The
corruption doesn't crash immediately, so `make test` segfaulted at
different, seemingly unrelated tests across runs. Pinning to
>=0.25.1,<0.26.0 (still excluding the aarch64-linux-broken 0.25.0)
eliminates the crash.
Also widen the exception handling in chunking.py's parser lookup to
catch tree_sitter_language_pack's own Error hierarchy, not just
LookupError: the currently locked tree_sitter_language_pack (1.14.3)
raises DownloadError for an unrecognized language instead of the
LookupError it used to raise, and normalize the re-raised exception
back to LookupError so callers keep the same contract.
@namelessnotionnamelessnotion changed the title fix: pin tree-sitter below 0.26.0 to fix segfault in make testfix: pin tree-sitter below 0.26.0 to fix segfaultAug 19, 2026
@codecov

codecovBot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (3eacce5) to head (dac873a).

Additional details and impacted files
@@ Coverage Diff @@## main #315 +/- ##
=======================================
Coverage 99.72% 99.72% =======================================
Files 25 25 Lines 1845 1845 =======================================
Hits 1840 1840 Misses 5 5 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for freeto 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.

1 participant

@namelessnotion