Skip to content

build: patch pprof for AsyncContextFrame labels on pointer-compressed V8 - #39

Draft
jrsells wants to merge 1 commit into
v26.13.1from
jrsells/node-v26.13.1-pprof-pointer-compression
Draft

jrsells wants to merge 1 commit into
v26.13.1from
jrsells/node-v26.13.1-pprof-pointer-compression

Conversation

@jrsells

@jrsells jrsells commented Dec 1, 2026

Copy link
Copy Markdown

Summary

Agent notes (Claude Opus 5.5)

LunaServer can't label Datadog CPU profile samples per request today. Labels need pprof's AsyncContextFrame (CPED) mode, and stock @datadog/pprof reads that map in its signal handler assuming 8-byte tagged fields, so it segfaults on our pointer-compressed V8 (DataDog/pprof-nodejs#428, still open). This patches pprof 5.15.1's map-get.cc to read 4-byte compressed fields when V8 is built with pointer compression. A static_assert against V8's headers catches a width mismatch at compile time. A labeling smoke test and a --stress-compaction soak fail the image build if the layout is wrong.

Nothing changes in LunaServer until codez picks up the new packages tarball and profiled pods set ASANA_PPROF_POINTER_COMPRESSION_SAFE=true (codez#473085 reads that flag).

Rollout once reviewed

  1. Build the packages from this branch, then stage and upload them by hand (the workflow's S3 step only runs from main). Note that running the packages workflow from a branch replaces the node-v26.13.1-release asset in place.
  2. Bump node_gyp_packages_{amd64,arm64}_node26 in codez.
  3. Set the flag on one profiled deployment as a canary.

Open questions

  • Carry this patch, upstream it on plans on incorporating LibreSSL nodejs/node#428, or both. pprof 5.16+ also adds otel-thread-ctx.cc, which refuses to build with pointer compression, so moving past 5.15.1 needs that fixed as well.
  • Worker threads have their own cages. The patch takes the cage base from the map's own address, so it should work there, but nothing tests workers yet.

Asana tasks: https://app.asana.com/1/15793206719/dev/space/1220418525288093/ticket/1221036693006503

CC:

Test Plan

  • The patch applies cleanly to pprof v5.15.1. The smoke test passes on stock Node 26.13.1 with stock pprof (labels split about 3:1 as expected), which checks the test itself, not the patch.
  • Earlier trial (the same patch in a trimmed copy of this Dockerfile, on nodejs26pc): stock pprof segfaults with CPED; the patched build labels correctly, survives a 30 s soak with and without --stress-compaction, and the 14-case LunaServer census suite passes.
  • Not yet done: building this Dockerfile as changed (no Docker here), on x64 and arm64.

Stock @datadog/pprof reads the AsyncContextFrame map in its signal
handler with 8-byte tagged fields, so CPED sample labels segfault on our
pointer-compressed Node 26. Read compressed fields when V8 is built with
pointer compression, and fail the image build if labels don't work or a
compaction-stress soak crashes.

Co-authored-by: Cursor <cursoragent@cursor.com>
@command-by-asana

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant