Skip to content

Segmentation fault at start of lsp_cross pass on repositories with 200+ files #340

@jjoos

Description

@jjoos

Description

After the May 8-9 LSP rework (commits adding py_lsp, php_lsp, TypeScript hybrid resolver, and the lsp_cross pipeline pass), codebase-memory-mcp segfaults immediately at the start of the lsp_cross pass when indexing medium-to-large repositories.

Reproduction

The crash happens consistently on any repository with ~200+ files. Observed on:

  • project 1: 268 files, 13,671 extracted nodes — crashes every time
  • project 2: 1,290 files — crashes after semantic_edges pass (heap corruption from earlier)

Logs

level=info msg=parallel.extract.done nodes=13671 errors=0
level=info msg=pass.timing pass=parallel_extract elapsed_ms=130
level=info msg=parallel.registry.start files=268
level=info msg=parallel.registry.done entries=889 defines=13671 imports=206
level=info msg=pass.timing pass=registry_build elapsed_ms=14
level=info msg=pass.start pass=lsp_cross files=268
Segmentation fault

The crash occurs within ~20ms of lsp_cross starting — before any per-file work is logged — suggesting an initialization bug (NULL dereference, uninitialized pointer, or allocation failure).

Bisect

  • 10a9b83 (May 8, before feat(pipeline): consume LSP-resolved calls in pass_calls): also crashes, but on a different repo and pass — suggests the bug may be in the underlying LSP resolver infrastructure landed just before
  • Commits before 2e042da (May 8, first Python LSP commit): likely safe but not yet confirmed
  • 06f7e0ee (April 30, pre-LSP): fully working — all repos index cleanly

Environment

  • Architecture: linux/arm64 (Docker, OrbStack on Apple M-series)
  • Build: compiled from source with gcc on Ubuntu 24.04
  • Confirmed reproducible across 3+ clean builds with --no-cache

Related

PR #339 fixes a separate but related issue (remaining fixed-size stacks in extract_channels.c) — that fix alone does not resolve this crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions