Commit 71f0f0f
fix: prevent aarch64 startup crash and cross-file doc chunk id collisions (#19)
* fix(docs): namespace doc chunk ids by source file (#16)
Indexing a second markdown file silently destroyed chunks from the first.
parse_markdown reset its counter per call, so every document minted
doc-0001, doc-0002, ... while that id is simultaneously the RocksDB key
(doc:{id} and docvec:{id}), the chunk_cache key and the HNSW point id -
a single global namespace. The second file wrote straight over the first,
which then vanished from codegraph_list_doc_sources and
codegraph_search_docs while indexing still reported status: success.
The loss was partial and size-dependent, which is why it read as
intermittent: a 3-chunk file took only the first 3 chunks of a 10-chunk
file, and the 7 survivors made the next remove_source look like it had
done its job. Re-indexing the larger file afterwards then wiped the
smaller one entirely.
Ids are now doc-{fnv1a(source_file):016x}-{counter:04}. FNV-1a rather
than DefaultHasher because the value is baked into a persisted key, and
DefaultHasher's output is explicitly not guaranteed stable across Rust
releases - a toolchain upgrade would silently orphan every chunk already
on disk. The reference vectors are pinned by a test for the same reason.
Old and new ids have different shapes, so they coexist safely and no
migration is needed. An index written before this change keeps whatever
survived until its sources are re-indexed.
Reproduced and verified end to end with the reporter's exact steps
against a real engine: before, indexing two files left list_doc_sources
reporting 1 source; after, it reports 2, re-indexing the first no longer
wipes the second, and both markers are findable via search_docs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rVbt7rENTwXkdHt3Bpgb5
* fix(server): make the glibc single-threaded shim writable (#15)
codegraph-server segfaulted at startup on Linux/aarch64 - every
invocation, including --version and --help, before main() ever ran.
The shim defined __libc_single_threaded as an immutable static, which
lands in .rodata, and its comment claimed "on newer glibc the real symbol
shadows this at runtime". That is the opposite of how ELF resolves it: a
definition in the executable takes precedence over the one in libc. On
aarch64 the symbol is also emitted into .dynsym, so glibc bound its own
startup write of the flag to our read-only byte and took SIGSEGV. x86_64
escaped it only because the symbol is not dynamically exported there, so
glibc kept using its own copy - which is why this looked environment-
specific and why the shipped x86_64 binaries were fine.
glibc owns the value: it sets the flag at startup and clears it on thread
creation. We only supply storage, wrapped in an UnsafeCell so it lands in
writable memory, and never read it. On a glibc too old to maintain it the
byte stays 0, the conservative "not single threaded" answer, so the
SLES 15 SP4 / glibc 2.31 case the shim exists for still links and runs.
Verified on aarch64 Ubuntu 24.04 (glibc 2.39), built from these sources:
before, --version and --help both exited 139 and the symbol was `R`;
after, the symbol is `B` and --version, --help and --info all exit 0.
codegraph-pro-server carries the same shim and needs the same change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rVbt7rENTwXkdHt3Bpgb5
* chore(release): bump to 0.20.1
Two engine crashes/data-loss bugs are fixed since 0.20.0, so the engine
needs a release of its own for clients to fetch:
#15 SIGSEGV at startup on Linux/aarch64, every invocation
#16 indexing a markdown file destroyed the previous file's chunks
Moves every pin together, which is the only safe way to move any of them:
Cargo.toml (and the workspace members in Cargo.lock), the two ENGINE_VERSION
pins clients fetch by (mcp-package/bin/fetch-engine.js, shared with the VS
Code client, and CodeGraphServerResolver.ENGINE_VERSION for JetBrains), the
npm package version, both version fields in server.json - the server entry
and the npm package it resolves to - the VSIX version, and pluginVersion.
publish-release-assets.sh refuses to publish while any client pin disagrees
with Cargo.toml, so a partial bump would have failed there rather than in
the field; keeping them in one commit keeps that check meaningful.
Note the ordering this creates: the clients now ask for release assets
tagged v0.20.1, which do not exist yet. Binaries have to be built and
scripts/publish-release-assets.sh run before this version is published to
npm, or installs will fetch nothing. package-npm.sh now refuses to package
until those assets are live.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017rVbt7rENTwXkdHt3Bpgb5
* no-mistakes(review): share writable glibc_single_threaded shim with test target
* no-mistakes(document): sync README vsix version, quiet new clippy lint
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>1 parent 860d12d commit 71f0f0f
15 files changed
Lines changed: 349 additions & 27 deletions
File tree
- crates
- codegraph-memory
- src
- tests
- codegraph-server/src
- jetbrains
- src/main/kotlin/ai/codegraph/jetbrains/server
- mcp-package
- bin
- vscode
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
97 | 136 | | |
98 | 137 | | |
99 | 138 | | |
| |||
221 | 260 | | |
222 | 261 | | |
223 | 262 | | |
224 | | - | |
| 263 | + | |
225 | 264 | | |
226 | 265 | | |
227 | 266 | | |
| |||
235 | 274 | | |
236 | 275 | | |
237 | 276 | | |
238 | | - | |
| 277 | + | |
239 | 278 | | |
240 | 279 | | |
241 | 280 | | |
| |||
254 | 293 | | |
255 | 294 | | |
256 | 295 | | |
257 | | - | |
| 296 | + | |
258 | 297 | | |
259 | 298 | | |
260 | 299 | | |
| |||
755 | 794 | | |
756 | 795 | | |
757 | 796 | | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
758 | 867 | | |
759 | 868 | | |
760 | 869 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
0 commit comments