Skip to content

fix(v10/node-core): Register the Vercel SIGTERM listener once - #25826

Open
sentry-junior[bot] wants to merge 2 commits into
v10from
fix/v10-node-core-vercel-sigterm-once
Open

sentry-junior[bot] wants to merge 2 commits into
v10from
fix/v10-node-core-vercel-sigterm-once

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

On Vercel, both @sentry/node-core init paths (default and /light) add a new SIGTERM listener on every init() call, and nothing ever removes it. Processes that call init() repeatedly therefore leak one listener per call, hit MaxListenersExceededWarning after 10, and flush every stale client on shutdown. The Sentry CLI hits this in library mode, since it re-inits per command during bundler-plugin source-map uploads (getsentry/toolkit#1692).

This takes the approach #25146 took on v11: keep one listener that flushes the latest client. That PR has a guard that registers only once. Here the helper instead checks whether its stable handler is already attached. That way, code that removes the listener (the existing tests do) gets a fresh one on the next init(). Both init paths share the helper, so mixing default and light init() also leaves a single listener.

This is v10-only. On develop, node-core was merged into @sentry/node and #25146 already covers it.

Fixes #25825

via @BYK.

--

View Junior Session [Sentry]

Both init() paths added a SIGTERM listener on every call when VERCEL is
set, so repeated init() leaked one listener per call and flushed stale
clients. Register a single shared listener that flushes the latest
client, matching #25146 on v11.

Fixes #25825

Co-Authored-By: Burak Yigit Kaya <126780+BYK@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.3 kB added added
@sentry/browser - with treeshaking flags 26.75 kB added added
@sentry/browser (incl. Tracing) 47.31 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 49.11 kB added added
@sentry/browser (incl. Tracing, Profiling) 52.09 kB added added
@sentry/browser (incl. Tracing, Replay) 86.76 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.39 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 91.48 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 104.09 kB added added
@sentry/browser (incl. Feedback) 45.48 kB added added
@sentry/browser (incl. sendFeedback) 33.11 kB added added
@sentry/browser (incl. FeedbackAsync) 38.23 kB added added
@sentry/browser (incl. Metrics) 29.39 kB added added
@sentry/browser (incl. Logs) 29.63 kB added added
@sentry/browser (incl. Metrics & Logs) 30.32 kB added added
@sentry/react 30.13 kB added added
@sentry/react (incl. Tracing) 49.62 kB added added
@sentry/vue 34.19 kB added added
@sentry/vue (incl. Tracing) 49.69 kB added added
@sentry/svelte 28.32 kB added added
CDN Bundle 30.72 kB added added
CDN Bundle (incl. Tracing) 49.28 kB added added
CDN Bundle (incl. Logs, Metrics) 32.31 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 50.6 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 71.81 kB added added
CDN Bundle (incl. Tracing, Replay) 87.01 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.31 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 92.83 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.11 kB added added
CDN Bundle - uncompressed 91.25 kB added added
CDN Bundle (incl. Tracing) - uncompressed 148.51 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 95.96 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.49 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 221.45 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 268.47 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.44 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 282.17 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.13 kB added added
@sentry/nextjs (client) 52.28 kB added added
@sentry/sveltekit (client) 47.75 kB added added
@sentry/core/server 81.7 kB added added
@sentry/core/browser 67.75 kB added added
@sentry/node-core 64.13 kB added added
@sentry/node 127.32 kB added added
@sentry/node (incl. diagnostics channel injection) 171.5 kB added added
@sentry/node/import (ESM hook with diagnostics-channel injection) 166 B added added
@sentry/node/light 52.23 kB added added
@sentry/node - without tracing 75.92 kB added added
@sentry/aws-serverless 85.08 kB added added
@sentry/cloudflare (withSentry) - minified 205 kB added added
@sentry/cloudflare (withSentry) 505.48 kB added added

@BYK
BYK marked this pull request as ready for review October 28, 2026 15:05
@BYK
BYK requested a review from a team as a code owner October 28, 2026 15:05
@BYK
BYK requested review from msonnb and stephanie-anderson and removed request for a team October 28, 2026 15:05

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this on v10 for a concrete reason? We decided to stop porting back every fix to v10, given v11 has been around for a while now and is stabilized. We can still backport it but there should be a reason to do so.

@BYK

BYK commented Oct 28, 2026

Copy link
Copy Markdown
Member

@Lms24

Do we need this on v10 for a concrete reason? We decided to stop porting back every fix to v10, given v11 has been around for a while now and is stabilized. We can still backport it but there should be a reason to do so.

No concrete reason if we stopped supporting v10. I remember hearing that we'll be supporting v10 a bit more and that's why I got this opened. Feel free to close, I won't be offended :D

This branch has not been deployed

No deployments
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.

3 participants