You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
profiling-node: profileLifecycle: 'trace' never stops the profiler when spans are unsampled, so Node never exits #25174
// index.mjs (package.json has "type": "module")// npm i @sentry/node@11.5.0 @sentry/profiling-node@11.5.0 && node index.mjsimport*asSentryfrom'@sentry/node'import{nodeProfilingIntegration}from'@sentry/profiling-node'Sentry.init({dsn: 'https://public@o0.ingest.sentry.io/0',tracesSampleRate: 0,// hangs at 0; exits at 1.0integrations: [nodeProfilingIntegration()],profileSessionSampleRate: 1.0,profileLifecycle: 'trace',})Sentry.startSpan({name: 'root'},()=>{Sentry.startSpan({name: 'child'},()=>{})})console.log('script finished, process should exit now')
Steps to Reproduce
Save the script above as index.mjs next to a package.json with "type": "module"
npm i @sentry/node@11.5.0 @sentry/profiling-node@11.5.0
node index.mjs. It logs, then never exits. With tracesSampleRate: 1.0, or without nodeProfilingIntegration, it exits immediately.
Expected Result
The process exits.
Actual Result
The process stays alive indefinitely whenever the trace is unsampled: every time with tracesSampleRate: 0, intermittently with 0.2. It never hangs with 1.0, or when nodeProfilingIntegration / profileSessionSampleRate is removed.
Additional Context
Unsampled child spans emit spanStart but never spanEnd. Unsampled root spans emit both. Hooking Client.emit in our app at tracesSampleRate: 0 gave 11 spanStart and 4 spanEnd (only the 4 root spans ended); at 1.0 it gave 11 of each.
In trace lifecycle mode, profiling-node increments activeSpanCounter on spanStart and only stops the chunk when spanEnd brings it from 1 to 0. So the counter never gets back to 0 and the chunk never stops. A Node diagnostic report shows the only referenced handle on the main loop is a 100ms repeating libuv timer, which matches MeasurementsTicker in the native profiler. That timer keeps the process alive. In long-running servers, the profiler runs continuously after the first unsampled trace.
Environment: Node 26.10.0 (also reproduced on 26.8.1), Linux x64 glibc 2.41, @sentry/node-cpu-profiler 2.4.4 (prebuilt binary for ABI 147).
Priority
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.
Activity
linear-code commentedon Oct 8, 2026
JS-3893
s1gr1d commentedon Oct 9, 2026
Hi and thanks for writing in! I checked this and can confirm that this is a bug. Created a PR for that: #25210
fix(profiling-node): Stop the trace lifecycle profiler when spans are…
github-actions commentedon Oct 12, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #25210, which was included in the 11.7.0 release.