fix(registry): add large-thread-count feature to raise slab MAX_THREADS#4
Closed
Maxence Caron (mc-ditto) wants to merge 8 commits intodeprecate-macros-for-ditto-loggingfrom
Closed
fix(registry): add large-thread-count feature to raise slab MAX_THREADS#4Maxence Caron (mc-ditto) wants to merge 8 commits intodeprecate-macros-for-ditto-loggingfrom
Maxence Caron (mc-ditto) wants to merge 8 commits intodeprecate-macros-for-ditto-loggingfrom
Conversation
Adds a `large-thread-count` feature (off by default) that raises the sharded-slab MAX_THREADS limit from 4 096 to 131 072. This prevents tracing_subscriber from panicking on high-core nodes where large numbers of native threads are spawned (e.g. by the Ditto SDK in load-gen pods). When the feature is disabled the upstream default of 4 096 is used via the Config trait's default impl, so there is no behaviour change for existing consumers. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… enabled Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…l init Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…gate The large-thread-count Cargo feature caused complex activation problems across multiple workspace boundaries in the Ditto monorepo. Since this fork is always used with Ditto builds, raise MAX_THREADS = 131_072 unconditionally — no feature flag required. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Make MAX_THREADS = 131_072 conditional on the `large-thread-count` feature flag rather than unconditional. The feature was previously removed to work around a cross-workspace patch issue in the ditto monorepo (now fixed by updating .cargo/config.toml patches). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On 32-bit targets (e.g. wasm32-unknown-unknown), MAX_THREADS = 131 072 requires 17 bits for thread IDs, which exhausts sharded-slab's bit-packing budget (total usize width = 32 bits) and causes a compile-time overflow in slot::Generation::LEN. Guard the raised constant behind `target_pointer_width = "64"` so wasm32 and other 32-bit targets fall back to the sharded-slab default of 4 096. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Madeleine Mortensen (maddiemort)
previously requested changes
Apr 17, 2026
Member
Madeleine Mortensen (maddiemort)
left a comment
There was a problem hiding this comment.
The logic is fine, but I'd prefer my comments to be addressed before we start using this.
My top concern was addressed
Madeleine Mortensen (maddiemort)
approved these changes
Apr 17, 2026
Comment on lines
+931
to
+935
| // Confirm the Registry pool is actually parameterised on SlabConfig — | ||
| // this is a compile-time check: if `Registry::spans` ever changes to a | ||
| // different Config type, the type annotation below will fail to compile. | ||
| let registry = Registry::default(); | ||
| let _: &Pool<DataInner, SlabConfig> = ®istry.spans; |
There was a problem hiding this comment.
Nice, that should do the trick - thanks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
large-thread-countfeature flag (off by default) totracing-subscriberSlabConfigraisesMAX_THREADSfrom 4 096 to 131 072, preventing panics when large numbers of native threads are spawned on high-core nodessharded-slabfork or workspace-level[patch.crates-io]overrideTest plan
cargo test -p tracing-subscriber --features large-thread-count— all tests passcargo test -p tracing-subscriber— all tests pass without the feature🤖 Generated with Claude Code