Skip to content

mz-debug: symbolization script#37793

Draft
SangJunBak wants to merge 3 commits into
MaterializeInc:mainfrom
SangJunBak:jun/mz-debug-symbolize-script
Draft

mz-debug: symbolization script#37793
SangJunBak wants to merge 3 commits into
MaterializeInc:mainfrom
SangJunBak:jun/mz-debug-symbolize-script

Conversation

@SangJunBak

Copy link
Copy Markdown
Contributor

/cpu turns on CPU profiling. Before, users could only turn it on via a webpage. We also ensure CPU and memory profiling cannot be turned on at the same time. This is because memory profiling and CPU profiling at the same time can cause deadlocks (see #3922 for more context). Thus before we start CPU profiling, we turn off memory profilng, then create a drop guard for the remainder of the CPU profiling execution that ensures memory profiling is turned back to its previous state after a drop.

/mode returns what profiling is enabled and allows users to turn on/off memory profiling.Remove these sections if your commit already has a good description!

Motivation

Why does this change exist? Link to a GitHub issue, design doc, Slack
thread, or explain the problem in a sentence or two. A reviewer who has
no context should understand why after reading this section.

If this implements or addresses an existing issue, it's enough to link to that:
Closes
Fixes
etc.

Description

What does this PR actually do? Focus on the approach and any non-obvious
decisions. The diff shows the code --- use this space to explain what the
diff can't tell a reviewer.

Verification

How do you know this change is correct? Describe new or existing automated
tests, or manual steps you took.

Because multi-process replicas can have multiple pods per service, we account for that when dumping resources.
Engineers symbolizing mz-debug profiles previously followed a manual guide:
install go, google/pprof, and graphviz, discover build IDs from pprof
errors, curl the executable and debug info per build ID from the debuginfo
service, and re-run pprof. This automates all of it.

profiles/symbolize.sh now ships inside every dump (embedded via
include_str!) and also lives in the repo behind bin/pprof-symbolize. It
needs only Docker and network access: it builds a small content-hashed
tool image (pinned google/pprof, graphviz, llvm), reads the build IDs out
of each profile's mappings, fetches executables and debug info from
https://debuginfo.dev.materialize.com into a local cache, and writes
shareable <name>.symbolized.pprof.gz files. A --http mode serves the
interactive pprof web UI. 404s from expired PR-build artifacts and junk
files degrade gracefully with per-profile statuses.

zip_debug_folder now preserves unix permissions so the script's executable
bit survives unzipping.

Verified end to end against profiles scraped from a kind cluster: all
profiles symbolize with full Rust frames, re-runs hit the cache, the web
UI serves, and the script embedded in a fresh dump zip runs as shipped.
@SangJunBak
SangJunBak force-pushed the jun/mz-debug-symbolize-script branch from 9c265b9 to e84d7dc Compare July 23, 2026 13:18
@SangJunBak SangJunBak changed the title prof-http: Extend profiling APIs with routes /cpu and /mode mz-debug: symbolization script Jul 23, 2026
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.

1 participant