diff --git a/Cargo.lock b/Cargo.lock index 6e0714f3..a3dd7de4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -963,7 +963,6 @@ dependencies = [ "tempfile", "thiserror 2.0.12", "thread_local", - "tikv-jemallocator", "tokio", "toml", "tower 0.5.2", @@ -3263,26 +3262,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tikv-jemalloc-sys" -version = "0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3c60906412afa9c2b5b5a48ca6a5abe5736aec9eb48ad05037a677e52e4e2d" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "tikv-jemallocator" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cec5ff18518d81584f477e9bfdf957f5bb0979b0bac3af4ca30b5b3ae2d2865" -dependencies = [ - "libc", - "tikv-jemalloc-sys", -] - [[package]] name = "time" version = "0.3.41" diff --git a/Cargo.toml b/Cargo.toml index d8fb1488..6c61f19e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -133,7 +133,6 @@ sha-1 = "0.10.1" strum = { version = "0.27.1", features = ["derive"] } thiserror = "2.0.12" thread_local = "1.1.8" -tikv-jemallocator = { version = "0.6.0", features = ["unprefixed_malloc_on_supported_platforms"], optional = true } tokio = { version = "1.44.1", features = ["fs", "macros", "signal", "sync"] } toml = "0.8.20" tower = { version = "0.5.2", features = ["util"] } @@ -164,7 +163,6 @@ opt-level = 3 default = ["rocksdb", "sqlite", "systemd"] # Keep sorted -jemalloc = ["dep:tikv-jemallocator"] rocksdb = ["dep:rocksdb"] sqlite = ["dep:rusqlite", "dep:parking_lot", "tokio/signal"] systemd = ["dep:sd-notify"] diff --git a/book/changelog.md b/book/changelog.md index cadf4c25..3729bfbb 100644 --- a/book/changelog.md +++ b/book/changelog.md @@ -85,6 +85,8 @@ This will be the first release of Grapevine since it was forked from Conduit `global.pdu_cache_capacity` configuration options. ([!124](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/124)) * Instead, it is now possible to configure each cache capacity individually. +10. Remove jemalloc support. + ([!93](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/193)) ### Changed @@ -171,81 +173,79 @@ This will be the first release of Grapevine since it was forked from Conduit ([!20 (263edcc)](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/20/diffs?commit_id=263edcc8a127ad2a541a3bb6ad35a8a459ea5616)) 6. Reduce the likelihood of locking up the async runtime. ([!19](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/19)) -7. Fix dynamically linked jemalloc builds. - ([!23](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/23)) -8. Fix search results not including subsequent pages in certain situations. +7. Fix search results not including subsequent pages in certain situations. ([!35 (0cdf032)](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/35/diffs?commit_id=0cdf03288ab8fa363c313bd929c8b5183d14ab77)) -9. Fix search results missing events in subsequent pages in certain situations. +8. Fix search results missing events in subsequent pages in certain situations. ([!35 (3551a6e)](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/35/diffs?commit_id=3551a6ef7a29219b9b30f50a7e8c92b92debcdcf)) -10. Only process admin commands if the admin bot is in the admin room. +9. Only process admin commands if the admin bot is in the admin room. ([!43](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/43)) -11. Fix bug where invalid account data from a client could prevent a user from +10. Fix bug where invalid account data from a client could prevent a user from joining any upgraded rooms and brick rooms that affected users attempted to upgrade. ([!53](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/53)) -12. Fix bug where unexpected keys were deleted from `m.direct` account data +11. Fix bug where unexpected keys were deleted from `m.direct` account data events when joining an upgraded room. ([!53](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/53)) -13. Fixed appservice users not receiving federated invites if the local server +12. Fixed appservice users not receiving federated invites if the local server isn't already resident in the room ([!80](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/80)) -14. Fix bug where, if a server has multiple public keys, only one would be fetched. +13. Fix bug where, if a server has multiple public keys, only one would be fetched. ([!78](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/78)) -15. Fix bug where expired keys may not be re-fetched in some scenarios. +14. Fix bug where expired keys may not be re-fetched in some scenarios. ([!78](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/78)) -16. Fix bug where signing keys would not be fetched when joining a room if we +15. Fix bug where signing keys would not be fetched when joining a room if we hadn't previously seen any signing keys from that server. ([!87](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/87)) -17. Fixed bug +16. Fixed bug ([#48](https://gitlab.computer.surgery/matrix/grapevine/-/issues/48)) that caused us to attempt to fetch our own signing keys from ourselves over federation, and fail ("Won't send federation request to ourselves"). ([!96](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/96)) -18. Fixed incoming HTTP/2 requests failing federation signature check. +17. Fixed incoming HTTP/2 requests failing federation signature check. ([!104](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/104)) -19. Return 403 instead of 500 when joins to a local-only room are denied. +18. Return 403 instead of 500 when joins to a local-only room are denied. Consequently fixes Heisenbridge being unable to join puppeted users to its rooms ([#85](https://gitlab.computer.surgery/matrix/grapevine/-/issues/85)). ([!127](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/127)) -20. Fix handling of v11 rooms with `m.room.create` event content that passes +19. Fix handling of v11 rooms with `m.room.create` event content that passes the authorization rules but doesn't match other parts of the spec. ([!139](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/139)) -21. Fix tiebreaking comparisons between events during state resolution. This +20. Fix tiebreaking comparisons between events during state resolution. This will reduce the rate at which servers disagree about the state of rooms. ([!141](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/141)) -22. Fix bug where the backoff state for remote device key queries was not reset +21. Fix bug where the backoff state for remote device key queries was not reset after a successful request, causing an increasing rate of key query failures over time until a server restart. ([!149](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/149)) -23. Fix bug where remote key queries that were skipped because the target server +22. Fix bug where remote key queries that were skipped because the target server was in backoff would increment the backoff delay further, leading to a positive feedback loop. ([!149](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/149)) -24. Return 504 M_NOT_YET_UPLOADED instead of 500 M_UNKNOWN when a media file is +23. Return 504 M_NOT_YET_UPLOADED instead of 500 M_UNKNOWN when a media file is present in the database but the contents are missing in the filesystem. Removing media from the filesystem was the only way to delete media before [!99](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/99), so this situation is common. ([!55](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/55)) ([!153](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/153)) -25. Return 400 M_BAD_ALIAS from +24. Return 400 M_BAD_ALIAS from [PUT /_matrix/client/v3/rooms/{roomId}/state/{eventType}/{stateKey}](https://spec.matrix.org/latest/client-server-api/#put_matrixclientv3roomsroomidstateeventtypestatekey) instead of 400 M_FORBIDDEN when trying to set a canonical alias that does not exist. ([!158](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/158)) -26. Validate schema of new `m.room.canonical_alias` event sent by clients, +25. Validate schema of new `m.room.canonical_alias` event sent by clients, rather than silently allowing any contents if the event can't be parsed. ([!158](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/158)) -27. Only validate canonical aliases that are new, rather than rather than +26. Only validate canonical aliases that are new, rather than rather than revalidating every alias. This makes it possible to add/remove aliases when some of the existing aliases cannot be validated. ([!158](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/158)) -28. Fix read receipts not being sent over federation (or only arbitrarily late) +27. Fix read receipts not being sent over federation (or only arbitrarily late) ([!162](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/162)) -29. Fix bug where ban reasons would be ignored when the banned user already had +28. Fix bug where ban reasons would be ignored when the banned user already had a member event in the room. ([!185](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/185)) -30. Stop stripping unknown properties from redaction events before sending them +29. Stop stripping unknown properties from redaction events before sending them to clients. ([!191](https://gitlab.computer.surgery/matrix/grapevine/-/merge_requests/191)) diff --git a/flake.nix b/flake.nix index f390239a..c9ca3630 100644 --- a/flake.nix +++ b/flake.nix @@ -37,10 +37,6 @@ inherit (pkgs) rocksdb; }; - rust-jemalloc-sys = self.callPackage ./nix/pkgs/rust-jemalloc-sys { - inherit (pkgs) rust-jemalloc-sys; - }; - shell = self.callPackage ./nix/shell.nix {}; # The Rust toolchain to use diff --git a/nix/pkgs/default/default.nix b/nix/pkgs/default/default.nix index a9abdc5a..c15b8f82 100644 --- a/nix/pkgs/default/default.nix +++ b/nix/pkgs/default/default.nix @@ -6,7 +6,6 @@ , pkgsBuildHost , rocksdb , rust -, rust-jemalloc-sys , snappy , stdenv @@ -35,19 +34,12 @@ let lib.optionals default-features allDefaultFeatures ++ lib.optionals all-features allFeatures); - featureEnabled = feature : builtins.elem feature features'; - buildDepsOnlyEnv = - let - rocksdb' = rocksdb.override { - enableJemalloc = featureEnabled "jemalloc"; - }; - in { NIX_OUTPATH_USED_AS_RANDOM_SEED = "randomseed"; CARGO_PROFILE = profile; - ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include"; - ROCKSDB_LIB_DIR = "${rocksdb'}/lib"; + ROCKSDB_INCLUDE_DIR = "${rocksdb}/include"; + ROCKSDB_LIB_DIR = "${rocksdb}/lib"; } // (import ./cross-compilation-env.nix { @@ -86,8 +78,6 @@ let dontStrip = profile != "release"; - buildInputs = lib.optional (featureEnabled "jemalloc") rust-jemalloc-sys; - nativeBuildInputs = [ # bindgen needs the build platform's libclang. Apparently due to "splicing # weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the diff --git a/nix/pkgs/rocksdb/default.nix b/nix/pkgs/rocksdb/default.nix index 9aa62353..6292e977 100644 --- a/nix/pkgs/rocksdb/default.nix +++ b/nix/pkgs/rocksdb/default.nix @@ -2,10 +2,6 @@ { inputs , lib , rocksdb -, rust-jemalloc-sys - -# Options (keep sorted) -, enableJemalloc ? false }: let @@ -17,10 +13,7 @@ let (builtins.readFile ../../../flake.lock) ).nodes.rocksdb.original.ref; })).override { - jemalloc = rust-jemalloc-sys; - enableLiburing = false; - inherit enableJemalloc; }; cVersion = rocksdb'.version; diff --git a/nix/pkgs/rust-jemalloc-sys/default.nix b/nix/pkgs/rust-jemalloc-sys/default.nix deleted file mode 100644 index 7d1b178d..00000000 --- a/nix/pkgs/rust-jemalloc-sys/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -# This derivation will set the JEMALLOC_OVERRIDE variable, causing the -# tikv-jemalloc-sys crate to use the nixpkgs jemalloc instead of building it's -# own. In order for this to work, we need to set flags on the build that match -# whatever flags tikv-jemalloc-sys was going to use. These are dependent on -# which features we enable in tikv-jemalloc-sys. - -{ rust-jemalloc-sys }: - -rust-jemalloc-sys.override { - # tikv-jemalloc-sys/unprefixed_malloc_on_supported_platforms feature - unprefixed = true; -} diff --git a/src/main.rs b/src/main.rs index 8f4268a1..fc6a3459 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,8 +5,6 @@ use std::process::ExitCode; use clap::Parser; -#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))] -use tikv_jemallocator::Jemalloc; use tracing::{error, info}; mod api; @@ -23,10 +21,6 @@ pub(crate) use config::Config; pub(crate) use service::{pdu::PduEvent, services, Services}; pub(crate) use utils::error::{Error, Result}; -#[cfg(all(not(target_env = "msvc"), feature = "jemalloc"))] -#[global_allocator] -static GLOBAL: Jemalloc = Jemalloc; - /// Returns the current version of the crate with extra info if supplied /// /// Set the environment variable `GRAPEVINE_VERSION_EXTRA` to any UTF-8 string