Skip to content

Commit 42d3d5f

Browse files
authored
Backport #5602: Use libunwind for jemalloc memory profiling stack traces (#5792)
## Motivation Backport of #5602, stacked on the backport of #5601. Switches jemalloc's stack trace collection from the default (frame pointers) to libunwind, which produces complete stack traces in release builds without requiring frame pointers. ## Proposal Cherry-pick of `9a3f534cbdb` onto the backport of #5601. ## Test Plan CI
1 parent 446702b commit 42d3d5f

4 files changed

Lines changed: 15 additions & 11 deletions

File tree

Cargo.lock

Lines changed: 4 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ test-log = { version = "0.2.15", default-features = false, features = [
261261
test-strategy = "0.3.1"
262262
thiserror = "1.0.65"
263263
thiserror-context = "0.1.1"
264-
tikv-jemallocator = "0.6.0"
264+
tikv-jemallocator = { git = "https://github.com/linera-io/jemallocator.git", rev = "16f3e75fb145e12f5ae15ed232d1368d4539fc14" }
265265
tokio = "1.36.0"
266266
tokio-stream = "0.1.14"
267267
tokio-test = "0.4.3"
@@ -407,3 +407,7 @@ range_minus_one = "deny"
407407
range_plus_one = "deny"
408408
ref_option_ref = "deny"
409409
str_split_at_newline = "deny"
410+
411+
[patch.crates-io]
412+
tikv-jemallocator = { git = "https://github.com/linera-io/jemallocator.git", rev = "16f3e75fb145e12f5ae15ed232d1368d4539fc14" }
413+
tikv-jemalloc-sys = { git = "https://github.com/linera-io/jemallocator.git", rev = "16f3e75fb145e12f5ae15ed232d1368d4539fc14" }

docker/Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ARG copy=${binaries:+_copy}
1717
ARG build_flag=--release
1818
ARG build_folder=release
1919
ARG build_features=scylladb,metrics,opentelemetry,jemalloc
20-
ARG rustflags="-C force-frame-pointers=yes"
20+
ARG rustflags="-C force-frame-pointers=yes -L /usr/lib/x86_64-linux-gnu"
2121

2222
FROM rust:1.86-slim-bookworm AS builder
2323
ARG git_commit
@@ -30,7 +30,8 @@ RUN apt-get update && apt-get install -y \
3030
pkg-config \
3131
protobuf-compiler \
3232
clang \
33-
make
33+
make \
34+
libunwind-dev
3435

3536
COPY . .
3637

@@ -72,7 +73,8 @@ LABEL build_date=$build_date
7273

7374
RUN apt-get update && apt-get install -y \
7475
ca-certificates \
75-
openssl
76+
openssl \
77+
libunwind8
7678
RUN update-ca-certificates
7779

7880
COPY --from=binaries \

linera-service/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ metrics = [
5454
]
5555
jemalloc = [
5656
"tikv-jemallocator",
57-
"tikv-jemallocator/profiling",
57+
"tikv-jemallocator/profiling_libunwind",
5858
"linera-metrics/jemalloc",
5959
]
6060
opentelemetry = ["linera-base/opentelemetry", "linera-rpc/opentelemetry"]

0 commit comments

Comments
 (0)