Repository navigation
fix: enable jemalloc only in host binaries - #58
Conversation
- Move RocksDB's jemalloc feature from enginelib to the engine binaries.
librocksdb-sys builds jemalloc with unprefixed malloc, so every mod that
linked enginelib carried a private heap: release mods failed dlopen
("cannot allocate memory in static TLS block") or corrupted memory crossing
run(&mut ServerAPI). enginelib is now allocator-neutral; a mod's malloc
binds to the one the host exports.
- #[derive(Verifiable)]: match the trait's verify(&self, &[u8]).
- Client::connect_timeout: bound the Hello handshake (connect waited 30 s
on a dead endpoint).
- EventBus::fire: don't record events in the tracing span; auth events
carry challenges and admin tokens.
- AGENTS.md: point to voltaero/magnesium (management mod) and document the
allocator rule for mods.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 24 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
[Medium impact] The PR appears safe to merge; both previous findings are addressed and no new actionable issues were found. SummaryMoves RocksDB's
Both previous test-coverage findings are addressed. No new actionable issues were found in the changes since the previous review.
|
Addresses review: the derive was never compiled by the tests (they implement Verifiable by hand), and connect_timeout had no test of its handshake deadline or of keeping the timeout afterwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why mods crash today
enginelibturns onrust-rocksdb'sjemallocfeature, andlibrocksdb-sysbuildstikv-jemalloc-syswithunprefixed_malloc_on_supported_platforms, so jemalloc replacesmalloc/free. Mods arecdylibs that link enginelib statically, so every mod carried its own private jemalloc:dlopenwith "cannot allocate memory in static TLS block" (jemalloc uses initial-exec TLS), orrun(&mut ServerAPI)(Arc<dyn Task>,Strings, registry entries) corrupts the heap.Fix
Enable the feature in
engine/Cargo.toml(host binaries) instead. The server still runs entirely on jemalloc (it exportsmalloc/free; checked withnm -D), and a mod built on its own has no allocator of its own: itsmallocbinds to the host's at load time, so there is one heap per process. Mods must be built as separate projects (the voltaero/mod template /cargo rf), not in a--workspacebuild with the engine, where the feature would unify back in. Documented inAGENTS.md.Also carried from the magnesium work (
ccc4318, already pinned by voltaero/magnesium):#[derive(Verifiable)]matchesverify(&self, &[u8]).Client::connect_timeoutbounds theHellohandshake.EventBus::fireno longer records events (auth challenges / admin tokens) in its tracing span.cargo test --workspacepasses.🤖 Generated with Claude Code