Skip to content

ref(core): Unref more timers in server and runtime-agnostic code#19177

Draft
Lms24 wants to merge 1 commit intodevelopfrom
lms/ref-core-unref-settimeout
Draft

ref(core): Unref more timers in server and runtime-agnostic code#19177
Lms24 wants to merge 1 commit intodevelopfrom
lms/ref-core-unref-settimeout

Conversation

@Lms24
Copy link
Member

@Lms24 Lms24 commented Feb 5, 2026

This PR wraps a bunch of setTimeout and setInterval calls with safeUnref to unref each created timer. unref'ing these timers avoids stalling the process exit in Node and other server runtimes.

Not sure if any of these timers actually cause hangs but we've had reports and fixes in the past for some of them. I figured, better safe than sorry here but we'll see if CI agrees with me :D

Note: Some of these changes only replace a manual .unref() call with the safeUnref wrapper. I figured it's probably better to always use safeUnref, should code ever end up in runtimes not supporting unref'ing.

@Lms24 Lms24 changed the title ref(core): Unref more timers in server code ref(core): Unref more timers in server and runtime-agnostic code Feb 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Codecov Results 📊


Generated by Codecov Action

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

size-limit report 📦

Path Size % Change Change
@sentry/browser 25.43 kB - -
@sentry/browser - with treeshaking flags 23.9 kB - -
@sentry/browser (incl. Tracing) 42.28 kB +0.01% +4 B 🔺
@sentry/browser (incl. Tracing, Profiling) 46.92 kB +0.01% +4 B 🔺
@sentry/browser (incl. Tracing, Replay) 80.92 kB +0.02% +11 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.52 kB +0.01% +6 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 85.62 kB +0.02% +10 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 97.8 kB +0.02% +10 B 🔺
@sentry/browser (incl. Feedback) 42.15 kB +0.01% +3 B 🔺
@sentry/browser (incl. sendFeedback) 30.11 kB +0.01% +1 B 🔺
@sentry/browser (incl. FeedbackAsync) 35.13 kB +0.02% +4 B 🔺
@sentry/browser (incl. Metrics) 26.54 kB - -
@sentry/browser (incl. Logs) 26.69 kB - -
@sentry/browser (incl. Metrics & Logs) 27.36 kB - -
@sentry/react 27.14 kB - -
@sentry/react (incl. Tracing) 44.52 kB +0.01% +3 B 🔺
@sentry/vue 29.87 kB - -
@sentry/vue (incl. Tracing) 44.1 kB +0.01% +4 B 🔺
@sentry/svelte 25.44 kB - -
CDN Bundle 27.97 kB - -
CDN Bundle (incl. Tracing) 43.04 kB +0.01% +1 B 🔺
CDN Bundle (incl. Logs, Metrics) 28.82 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 43.87 kB +0.01% +1 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 67.76 kB +0.02% +7 B 🔺
CDN Bundle (incl. Tracing, Replay) 79.81 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 80.67 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 85.23 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 86.14 kB +0.01% +7 B 🔺
CDN Bundle - uncompressed 81.83 kB - -
CDN Bundle (incl. Tracing) - uncompressed 127.55 kB +0.01% +8 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 84.66 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 130.38 kB +0.01% +8 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 208.05 kB +0.01% +8 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 244.16 kB +0.01% +16 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 246.98 kB +0.01% +16 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 256.96 kB +0.01% +20 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 259.77 kB +0.01% +20 B 🔺
@sentry/nextjs (client) 46.87 kB +0.01% +2 B 🔺
@sentry/sveltekit (client) 42.66 kB +0.02% +5 B 🔺
@sentry/node-core 52.19 kB +0.03% +11 B 🔺
@sentry/node 166.31 kB +0.01% +7 B 🔺
@sentry/node - without tracing 93.96 kB -0.01% -1 B 🔽
@sentry/aws-serverless 109.48 kB +0.01% +1 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 8,936 - 11,642 -23%
GET With Sentry 1,685 19% 1,861 -9%
GET With Sentry (error only) 6,099 68% 7,522 -19%
POST Baseline 1,210 - 1,123 +8%
POST With Sentry 599 50% 582 +3%
POST With Sentry (error only) 1,066 88% 1,016 +5%
MYSQL Baseline 3,274 - 4,072 -20%
MYSQL With Sentry 483 15% 532 -9%
MYSQL With Sentry (error only) 2,670 82% 3,283 -19%

View base workflow run

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