Skip to content

Conversation

@xDimon
Copy link
Contributor

@xDimon xDimon commented Nov 10, 2025

Description:

This PR introduces an optional feature x-shadow that disables the use of jemalloc, as it leads to deadlocks when running under the Shadow network simulator.

  • Adds the x-shadow feature flag in Cargo.toml.
  • When the feature is enabled, jemalloc is not used as the global allocator.
  • Default builds remain unchanged — jemalloc stays active unless explicitly disabled.

Rationale:

In the Shadow simulation environment, the initialization of jemalloc becomes re-entrant due to Shadow’s interception of system calls. This reentrancy causes jemalloc to deadlock during startup. Disabling jemalloc under the x-shadow feature prevents these deadlocks and allows the simulation to run reliably, while keeping the allocator behavior unchanged for normal builds.

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please no.

What you want to do here is to make the jemalloc feature configurable. Aka you expose the feature from this crate and make it enabled by default. Basically what you already have done here. But, you don't introduce any kind of "x-shadow" feature, because that clearly doesn't belong here.

@bkchr bkchr changed the title Add x-shadow feature to disable hard-coded jemalloc inclusion for Shadow simulation kvdb-rocksdb: Make snappy and jemalloc configurable features Nov 17, 2025
@bkchr
Copy link
Member

bkchr commented Nov 17, 2025

@xDimon please update the Changelog file.

@xDimon xDimon force-pushed the xDimon/shadow_simulation_support branch from 143437d to 919fec1 Compare November 17, 2025 08:08
@xDimon
Copy link
Contributor Author

xDimon commented Nov 17, 2025

@xDimon please update the Changelog file.

@bkchr, done

@xDimon xDimon requested a review from bkchr November 17, 2025 11:44
@bkchr bkchr merged commit b9343bc into paritytech:master Nov 17, 2025
6 checks passed
kayabaNerve added a commit to serai-dex/serai that referenced this pull request Dec 1, 2025
For hash-pinned dependencies, adds comments documenting the associated
versions.

Adds a pin to `slither-analyzer` which was prior missing.

Updates to Monero 0.18.4.4.

`mimalloc` now has the correct option set when building for `musl`. A C++
compiler is no longer required in its Docker image.

The runtime's `Dockerfile` now symlinks a `libc.so` already present on the
image instead of creating one itself. It also builds the runtime within the
image to ensure it only happens once. The test to ensure the methodology is
reproducible has been updated to not simply create containers from the image,
yet rebuild the image entirely, accordingly. This also is more robust and
arguably should have already been done.

The pin to the exact hash of the `patch-polkadot-sdk` repo in every
`Cargo.toml` has been removed. The lockfile already serves that role,
simplifying updating in the future.

The latest Rust nightly is adopted as well (superseding
#697).

The `librocksdb-sys` patch is replaced with a `kvdb-rocksdb` patch, removing a
git dependency, thanks to paritytech/parity-common#950.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants