Skip to content

clangd enrichment can trigger clang-tidy crashes and high CPU #220

Description

@darthghandi

Summary

Gortex auto-registers clangd for C/C++ repos and currently launches it with --background-index --header-insertion=never. On a large C/C++ repo, semantic enrichment drives a very large LSP workload through clangd. If the repo has a broad .clang-tidy (bugprone-*, readability-*, clang-analyzer-*, performance-*, etc.), clangd 22.1.6 can repeatedly crash while running clang-tidy matchers. Gortex then reconnects and repeats the work, keeping clangd at high CPU.

Evidence

A daemon log showed:

  • semantic enrichment starting for lsp-clangd
  • clangd argv: --background-index --header-insertion=never
  • repeated crash stack dumps in clang-tidy checks:
    • bugprone-pointer-arithmetic-on-polymorphic-object
    • bugprone-not-null-terminated-result
    • performance-unnecessary-copy-initialization
  • one completed clangd enrichment run took ~113 minutes and included tens of thousands of LSP requests.

Proposed fix

For gortex semantic enrichment, default clangd should avoid lint diagnostics and background indexing, e.g. --clang-tidy=false --background-index=false --header-insertion=never -j=1. Gortex needs semantic graph signal, not clang-tidy diagnostics, and should avoid reconnect loops amplifying repeated clangd crashes.

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