Repository navigation
fix: Unref fetch and react-router timeout timers, require unref'd server timers - #26881
Open
sentry-junior[bot] wants to merge 3 commits into
Open
sentry-junior[bot] wants to merge 3 commits into
sentry-junior[bot] wants to merge 3 commits into
Conversation
Add the sdk/require-timer-unref Oxlint rule. It flags setTimeout and setInterval calls in code that can run on Node, Bun or Deno when the timer is never passed to safeUnref() or unref'd, because such a timer keeps CLI tools and scripts from exiting. Existing timers that have to keep the process alive get a disable comment with the reason. No runtime behavior changes. Part of #26852 Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
4 of 13 tasks
Contributor
size-limit report 📦Compared: 8224899 (PR test merge using develop at 40fb1a8) Against: 40fb1a8 (develop) · base run #67947 ✅ Baseline matches: this diff contains only this PR's changes.
|
Contributor
Optional E2E testsSome optional checks were not successful. They do not block the merge. 2 not successful, 84 successful. See the run.
Successful checks
|
These timers only cancel a stalled response-body read or abort a render that outlives streamTimeout, so they should not keep the process alive. Co-Authored-By: Francesco Gringl-Novy <2411343+mydea@users.noreply.github.com>
mydea
marked this pull request as ready for review
November 25, 2026 14:48
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the
sdk/require-timer-unrefOxlint rule. It flagssetTimeout/setIntervalcalls in code that can run on Node, Bun or Deno when the timer is never passed tosafeUnref()/_INTERNAL_safeUnref()/Deno.unrefTimer()and never has.unref()called on it (directly, or on the variable or property it is stored in). The Bugbot timer rule is narrowed to what lint can't see.Behavior change: the 90s and 5s response-body read timeouts in
core/src/instrument/fetch.tsand thestreamTimeoutabort inreact-router/src/server/createSentryHandleRequest.tsxare now unref'd, so they no longer keep the process alive. They only cancel a stalled body read or abort a render, and the web-stream variant of the React Router handler already unref'd its abort timer.Why
A timer that isn't unref'd keeps CLI tools and scripts from exiting. A lint rule checks this on every change instead of leaving it to AI review.
Scope: everything under
packages/*/srcexcept browser-facing code (utils/browser-facing.js),*.client.*entry files, andintegration-shims/replay-worker.coreis in scope because every server SDK runs it, and build-time packages are in scope because they run in Node.cloudflareandvercel-edgeare scoped out: theirsetTimeoutreturns a number that can't be unref'd, and the platform controls the isolate's lifetime.Of the 17 current hits, 3 get
safeUnref()(above) and 14 get anoxlint-disable-next-linecomment with the reason. Those 14 must keep the process alive: worker-thread keep-alives, the fatal-error and ANR send timers,flush()waits, and the webpack force-exit. The idle-span timers incoreonly run from browser code in practice, so they also get a disable comment.Part of #26852
via @mydea.
--
View Session [Sentry]