trailmark analyze --language go segfaults when parsing directories containing Go files over ~15-20KB. Reproducible on both macOS ARM (Apple Silicon) and Linux x86_64. Python and TypeScript parsing work fine at any size.
Minimal repro:
uv venv --python 3.13 && source .venv/bin/activate
uv pip install trailmark # 0.4.0
git clone --depth 1 https://github.com/junegunn/fzf.git /tmp/fzf
trailmark analyze --language go --summary /tmp/fzf/src
# exit 139 (SIGSEGV) on Linux, exit 138 (SIGBUS) on macOS ARM
Also reproduced with openshift/cluster-kube-apiserver-operator — copying a single ~21KB Go file (pkg/cmd/render/render.go) into an otherwise empty directory and running trailmark analyze --language go --summary on it is enough to trigger the crash.
I isolated it down to the tree-sitter node access layer. The initial Parser.parse(source) succeeds — returns a valid tree with 28 children. The crash happens when subsequently accessing node properties (.text, .start_point, .children) during the AST walk, not in trailmark's Python code itself:
from tree_sitter import Parser
from tree_sitter_language_pack import get_language
from pathlib import Path
parser = Parser(get_language("go"))
source = Path("/tmp/crash-test/render.go").read_bytes() # ~21KB
tree = parser.parse(source)
root = tree.root_node
print(len(root.children)) # 28 — works
for child in root.children:
_ = child.start_point # segfaults on later children
With gc.disable() the node access sometimes succeeds but the process still crashes on exit during Python finalization. The crash is non-deterministic — depends on GC timing and memory layout. Small Go files (<5KB) never hit it.
Environment: trailmark 0.4.0, tree-sitter 0.26.0, tree-sitter-language-pack 1.12.1, Python 3.13.5. Tested on macOS 15 (M3, SIGBUS) and Linux x86_64 via python:3.13-slim Docker (SIGSEGV).
This looks related to py-tree-sitter #386 and #330 — native memory corruption in the C extension that was previously fixed for aarch64-linux GCC builds but seems to affect other platforms with larger input buffers.
trailmark analyze --language gosegfaults when parsing directories containing Go files over ~15-20KB. Reproducible on both macOS ARM (Apple Silicon) and Linux x86_64. Python and TypeScript parsing work fine at any size.Minimal repro:
Also reproduced with
openshift/cluster-kube-apiserver-operator— copying a single ~21KB Go file (pkg/cmd/render/render.go) into an otherwise empty directory and runningtrailmark analyze --language go --summaryon it is enough to trigger the crash.I isolated it down to the tree-sitter node access layer. The initial
Parser.parse(source)succeeds — returns a valid tree with 28 children. The crash happens when subsequently accessing node properties (.text,.start_point,.children) during the AST walk, not in trailmark's Python code itself:With
gc.disable()the node access sometimes succeeds but the process still crashes on exit during Python finalization. The crash is non-deterministic — depends on GC timing and memory layout. Small Go files (<5KB) never hit it.Environment: trailmark 0.4.0, tree-sitter 0.26.0, tree-sitter-language-pack 1.12.1, Python 3.13.5. Tested on macOS 15 (M3, SIGBUS) and Linux x86_64 via
python:3.13-slimDocker (SIGSEGV).This looks related to py-tree-sitter #386 and #330 — native memory corruption in the C extension that was previously fixed for aarch64-linux GCC builds but seems to affect other platforms with larger input buffers.