From f5f23c24ff7cd4d2169aa09eae38d386108abbca Mon Sep 17 00:00:00 2001 From: Eric Fu Date: Thu, 14 Sep 2023 14:32:59 +0800 Subject: [PATCH] fix: panic when dumping memory profile (#12276) --- Cargo.lock | 6 +++--- Cargo.toml | 4 ++++ src/batch/Cargo.toml | 2 +- src/cmd/Cargo.toml | 6 ++---- src/cmd_all/Cargo.toml | 12 +++++++----- src/compute/Cargo.toml | 2 +- src/compute/src/memory_management/policy.rs | 5 ++--- src/tests/simulation/Cargo.toml | 4 +--- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1069bd493b20..9def736f6dab 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8927,7 +8927,7 @@ dependencies = [ [[package]] name = "tikv-jemalloc-ctl" version = "0.5.4" -source = "git+https://github.com/risingwavelabs/jemallocator.git?rev=b7f9f3#b7f9f34664dcfea190e64bef64587e23f9f2710c" +source = "git+https://github.com/risingwavelabs/jemallocator.git?rev=64a2d9#64a2d988d687a94cd859855e19241cd8b0705466" dependencies = [ "libc", "paste", @@ -8937,7 +8937,7 @@ dependencies = [ [[package]] name = "tikv-jemalloc-sys" version = "0.5.4+5.3.0-patched" -source = "git+https://github.com/risingwavelabs/jemallocator.git?rev=b7f9f3#b7f9f34664dcfea190e64bef64587e23f9f2710c" +source = "git+https://github.com/risingwavelabs/jemallocator.git?rev=64a2d9#64a2d988d687a94cd859855e19241cd8b0705466" dependencies = [ "cc", "libc", @@ -8946,7 +8946,7 @@ dependencies = [ [[package]] name = "tikv-jemallocator" version = "0.5.4" -source = "git+https://github.com/risingwavelabs/jemallocator.git?rev=b7f9f3#b7f9f34664dcfea190e64bef64587e23f9f2710c" +source = "git+https://github.com/risingwavelabs/jemallocator.git?rev=64a2d9#64a2d988d687a94cd859855e19241cd8b0705466" dependencies = [ "libc", "tikv-jemalloc-sys", diff --git a/Cargo.toml b/Cargo.toml index e33c09ddc573..332bc5f8e7ac 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -112,6 +112,10 @@ arrow-schema = "46" arrow-buffer = "46" arrow-flight = "46" arrow-select = "46" +tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ + "profiling", + "stats", +], rev = "64a2d9" } risingwave_backup = { path = "./src/storage/backup" } risingwave_batch = { path = "./src/batch" } diff --git a/src/batch/Cargo.toml b/src/batch/Cargo.toml index 5f90151a400a..35ede881bc47 100644 --- a/src/batch/Cargo.toml +++ b/src/batch/Cargo.toml @@ -67,7 +67,7 @@ rand = "0.8" tempfile = "3" [target.'cfg(unix)'.dev-dependencies] -tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "b7f9f3" } +tikv-jemallocator = { workspace = true } [[bench]] name = "filter" diff --git a/src/cmd/Cargo.toml b/src/cmd/Cargo.toml index 46a33654d354..894d19c9f969 100644 --- a/src/cmd/Cargo.toml +++ b/src/cmd/Cargo.toml @@ -46,11 +46,9 @@ workspace-hack = { path = "../workspace-hack" } task_stats_alloc = { path = "../utils/task_stats_alloc" } [target.'cfg(unix)'.dependencies] -tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ - "profiling", - "stats", +tikv-jemallocator = { workspace = true, features = [ "unprefixed_malloc_on_supported_platforms", -], rev = "b7f9f3" } +] } [[bin]] name = "frontend" diff --git a/src/cmd_all/Cargo.toml b/src/cmd_all/Cargo.toml index b6907cdebaef..f22f0b59ea2d 100644 --- a/src/cmd_all/Cargo.toml +++ b/src/cmd_all/Cargo.toml @@ -53,17 +53,19 @@ workspace-hack = { path = "../workspace-hack" } expect-test = "1" [build-dependencies] -vergen = { version = "8", default-features = false, features = ["build", "git", "gitcl"] } +vergen = { version = "8", default-features = false, features = [ + "build", + "git", + "gitcl", +] } [target.'cfg(enable_task_local_alloc)'.dependencies] task_stats_alloc = { path = "../utils/task_stats_alloc" } [target.'cfg(unix)'.dependencies] -tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ - "profiling", - "stats", +tikv-jemallocator = { workspace = true, features = [ "unprefixed_malloc_on_supported_platforms", -], rev = "b7f9f3" } +] } [[bin]] name = "risingwave" diff --git a/src/compute/Cargo.toml b/src/compute/Cargo.toml index 7774a2d91773..e0e2a4ab0528 100644 --- a/src/compute/Cargo.toml +++ b/src/compute/Cargo.toml @@ -55,7 +55,7 @@ tower = { version = "0.4", features = ["util", "load-shed"] } tracing = "0.1" [target.'cfg(target_os = "linux")'.dependencies] -tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "b7f9f3" } +tikv-jemalloc-ctl = { git = "https://github.com/risingwavelabs/jemallocator.git", rev = "64a2d9" } [target.'cfg(not(madsim))'.dependencies] workspace-hack = { path = "../workspace-hack" } diff --git a/src/compute/src/memory_management/policy.rs b/src/compute/src/memory_management/policy.rs index 5c3602a46fe6..005edb813f82 100644 --- a/src/compute/src/memory_management/policy.rs +++ b/src/compute/src/memory_management/policy.rs @@ -128,9 +128,8 @@ impl JemallocMemoryControl { .unwrap() .to_string() } else { - let prof_prefix_mib = jemalloc_prof::prefix::mib().unwrap(); - let prof_prefix = prof_prefix_mib.read().unwrap(); - let mut file_path = prof_prefix.to_string_lossy().to_string(); + let prof_prefix = jemalloc_opt::prof_prefix::read().unwrap(); + let mut file_path = prof_prefix.to_str().unwrap().to_string(); file_path.push_str(&file_name); file_path }; diff --git a/src/tests/simulation/Cargo.toml b/src/tests/simulation/Cargo.toml index 594f06b3b61c..0e7b4e0d8be8 100644 --- a/src/tests/simulation/Cargo.toml +++ b/src/tests/simulation/Cargo.toml @@ -46,9 +46,7 @@ serde_derive = "1.0.188" serde_json = "1.0.106" sqllogictest = "0.15.3" tempfile = "3" -tikv-jemallocator = { git = "https://github.com/risingwavelabs/jemallocator.git", features = [ - "profiling", -], rev = "b7f9f3" } +tikv-jemallocator = { workspace = true } tokio = { version = "0.2.23", package = "madsim-tokio" } tokio-postgres = "0.7" tracing = "0.1"