Uh oh!
There was an error while loading. Please reload this page.
fix(core): Avoid blocking the process when calling flush on empty buffer - #19062
Merged
Conversation
CopilotAI
changed the title
[WIP] Fix bug for issue 18996 in sentry-javascriptFix client.flush() blocking process exit due to non-unref'd timersJan 28, 2026
flush on empty bufferContributor
size-limit report 📦
|
Contributor
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.
|
chargome
approved these changes
Jan 29, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Jan 29, 2026
Lms24
marked this pull request as ready for review
January 29, 2026 16:51
…y exit Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com>
Co-authored-by: Lms24 <8420481+Lms24@users.noreply.github.com>
Co-authored-by: Charly Gomez <charly.gomez@sentry.io>
Lms24force-pushed
the
copilot/fix-issue-18996-bug
branch
from
January 29, 2026 17:22
0ad6633 to
917fc69CompareThere was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Lms24 added a commit
that referenced
this pull request
Feb 4, 2026
This was referenced Feb 5, 2026
JPeer264 added a commit
that referenced
this pull request
Feb 5, 2026
closes#19171 closes [JS-1641](https://linear.app/getsentry/issue/JS-1641/metrics-flush-timer-should-use-unref-to-not-block-process-exit) This was is something that got missed by Copilot on #19062
BYK added a commit
to getsentry/cli
that referenced
this pull request
Feb 16, 2026
…es (#249) ## Summary Upgrade `@sentry/bun` and `@sentry/node` from 10.38.0 → 10.39.0 and remove all custom patches/workarounds that are now fixed upstream. ## Changes - **Removed `patches/@sentry%2Fcore@10.38.0.patch`** (92 lines) — Added `.unref()` to timers in `setupWeightBasedFlushing`, `_isClientDoneProcessing`, and `makePromiseBuffer` to prevent the CLI from hanging on exit. Fixed upstream by [#19062](getsentry/sentry-javascript#19062) and [#19174](getsentry/sentry-javascript#19174). - **Removed runtime context workaround in `src/lib/telemetry.ts`** (14 lines) — Manually overrode `options.runtime` after `Sentry.init()` to report Bun instead of Node.js. Fixed upstream — `NodeClient` now uses `options.runtime || { name: 'node', ... }` and `@sentry/bun` passes `{ name: 'bun', version: Bun.version }`. Tracked as [#19269](getsentry/sentry-javascript#19269). - **Updated `package.json`** — Bumped both SDK packages to `10.39.0` and removed `@sentry/core` from `patchedDependencies`. ## Verification - Verified all three upstream fixes by reading the 10.39.0 source code and linked PRs - `bun install`, typecheck, lint, and tests all pass cleanly - No new test failures introduced (pre-existing ~95 failures on `main` are unrelated)
5 tasks
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 freeto 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.
PR and description checked and updated by @Lms24
This PR fixes a bug when calling
Sentry.flush()(orclient.flush()) and there's no telemetry being processed by the SDK. While previously we'd wait for the passed-in timeout, we now exit early.In addition, this also calls
unref()on started timeouts for server SDKs so that pending timeouts started by the SDK don't block the process from exiting.