Productionize Linux jemalloc heap profiling#12265
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR enables Linux dev and preview bundles to upload symbolized jemalloc heap profiles by using the in-process jemalloc_pprof dump path and preserving the executable symbol table when heap usage tracking is enabled. Stable Linux builds remain outside the rollout.
Concerns
- No blocking correctness, security, or spec-drift concerns found in the annotated diff.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
Enable automatic symbolized jemalloc heap profiling on Linux (notably the headless Oz remote-server daemon), matching what macOS already does. - profiling.rs: on Linux, dump the symbolized, gzipped pprof profile in-process via jemalloc_pprof (no external pprof binary, HTTP server, or port required); keep the external-pprof path for macOS, where in-process symbolization is unsupported. - script/linux/bundle: enable jemalloc_pprof,heap_usage_tracking for the dev and preview channels, and stop strip --strip-all (use --strip-debug to retain the symbol table) for builds with heap profiling enabled, since in-process symbolization resolves against the running binary's own symbols. CHANGELOG-NONE
2a0d98e to
dd1e1ce
Compare

Description
Productionizes automatic jemalloc heap profiling on Linux so high-memory events upload a heap profile to Sentry, matching what macOS already does.
The key difference from macOS: the Linux profile is uploaded unsymbolized (raw pprof). It carries sample addresses + memory mappings + the GNU build-id, and is symbolized offline against the debug-info file (DIF) the release pipeline already uploads to Sentry — the same artifact used to symbolize panics, matched by build-id. This lets the shipped binary stay fully stripped (no symbol-table bloat) while still producing usable, symbolizable profiles.
What changed
app/src/profiling.rs: on Linux, dump the gzipped pprof in-process viajemalloc_pprof(dump_jemalloc_pprof_bytes) — no externalpprofbinary, HTTP server, or fixed port (essential for the headless remote-server daemon). The dump is now raw / unsymbolized. The external-pprofpath is kept for macOS, where in-process symbolization stays.app/Cargo.toml: buildjemalloc_pprofwithout thesymbolizefeature, sodump_pprof()returns a raw profile instead of symbolizing in-process (in-process symbolization would have required keeping the symbol table in the shipped binary).Cargo.lock: bumpjemalloc_pprof/pprof_utilto0.8.2. This is required:0.8.2writes a usable mapping range (memory_limit = u64::MAX), whereas0.8.1wrotememory_limit = 0, leaving pprof unable to bind sample addresses to the binary — so profiles would be unsymbolizable even with the correct DIF. (See this PR: Use max limit in mappings polarsignals/rust-jemalloc-pprof#31)script/linux/bundle: enablejemalloc_pprof,heap_usage_trackingfor thedevandpreviewchannels, and keep the normal strip behavior (--strip-allfor non-dev builds). The shipped binary stays small; symbols live only in the uploaded DIF.Symbolizing a Linux heap profile (offline, via the Sentry DIF)
The release pipeline already uploads each build's debug-info file to Sentry (
script/sentry_upload_dif.sh), keyed by GNU build-id. To analyze aheap-profile.pbfrom an "Excessive memory usage detected" event:The DIF carries
.symtab+ DWARF, so frames resolve to function names with file:line and inlined frames. (addr2line -e difs/$BUILD_ID.debug <addr>works as a lower-level alternative.)Notes / scope
pprofbinary is bundled on Linux (in-process raw dump).stableLinux builds are unchanged (no profiling features) — enabling fordev+previewfirst.Linked Issue
N/A — infrastructure/observability follow-up.
Testing
cargo check+cargo clippy -- -D warningsfor the app lib targeting Linux withheap_usage_tracking(exercises the new raw-dump branch); macOS host path also checked (validates thepprof_binary_pathcfg-gate) — passes../script/format— no changes beyond the edited files.End-to-end validated on a build sharing this exact code path
I have manually tested my changes locally with
./script/runAgent Mode
CHANGELOG-NONE
🤖 Generated with Warp Agent Mode
Conversation: https://staging.warp.dev/conversation/e6ba6343-1bb8-4cce-a155-6f0b453bad40
Plan: https://staging.warp.dev/drive/notebook/359wXMjgAzXhtOZfnSWUlA