Skip to content

fix: drop multipart upload path; ingest with format=pprof - #316

Merged
jake-kramer merged 2 commits into
mainfrom
fix/ingest-format-pprof
Jul 27, 2026
Merged

fix: drop multipart upload path; ingest with format=pprof#316
jake-kramer merged 2 commits into
mainfrom
fix/ingest-format-pprof

Conversation

@jake-kramer

Copy link
Copy Markdown
Contributor

Uploading via FormData+Blob leaks native memory on Node 24.16+/26.x: undici's fetch serializes Blob parts through Blob.prototype.stream(), which pins every payload forever (nodejs/node#63574). An earlier fix (#311) kept multipart and hand-built the body. This change instead removes the multipart path instead and sends the gzipped pprof bytes raw to /ingest?format=pprof which the server parses identically.

Fixes #28

Uploading via FormData+Blob leaks native memory on Node 24.16+/26.x:
undici's fetch serializes Blob parts through Blob.prototype.stream(),
which pins every payload forever (nodejs/node#63574). An earlier fix (#311)
kept multipart and hand-built the body. This change instead removes
the multipart path instead and sends the gzipped pprof
bytes raw to /ingest?format=pprof which the server parses identically.

Fixes #28
@jake-kramer
jake-kramer requested review from a team as code owners July 27, 2026 14:54
@cla-assistant

cla-assistant Bot commented Jul 27, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

bryanhuhta
bryanhuhta previously approved these changes Jul 27, 2026
Comment thread src/pyroscope-api-exporter.ts Outdated
Comment thread test/profiler.test.ts
Comment thread test/profiler.test.ts
@jake-kramer
jake-kramer merged commit 298cd17 into main Jul 27, 2026
16 of 17 checks passed
@jake-kramer
jake-kramer deleted the fix/ingest-format-pprof branch July 27, 2026 18:34
ZacxDev added a commit to civitai/civitai that referenced this pull request Aug 10, 2026
0.6.2 fixes a native memory leak in the profile-upload path: the
FormData/Blob upload pinned an ArrayBuffer per flush via undici
(grafana/pyroscope-nodejs#316, nodejs/node#63574). The multipart path is
replaced by sending the gzipped pprof bytes raw to /ingest?format=pprof.

The leak affects Node 24.16+, which is the range this app runs in. This
is a precautionary bump onto the upstream fix, not a response to an
observed incident.

The profiler itself is unchanged: @datadog/pprof stays pinned at exactly
5.14.4 in both versions, so only the SDK's upload path moves.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Memory leak when Pyroscope is enabled

2 participants