Node: process never exits since 10.72 — beforeExit session send + client-report flush feed each other (skipOpenTelemetrySetup: true)
@logaretm 已经在做这个了。
开始于 2026年9月10日。
评估
这个 Issue 还没有评估数据。
描述
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/node
SDK Version
10.73.0 (also 10.72.0; 10.54.0 is fine)
Framework Version
Node 22.22.2
Link to Sentry event
No response
Reproduction Example/SDK Setup
// repro.mjs — run with a DSN pointing at any HTTP server that answers 200, e.g. a stub on localhost
import * as Sentry from "@sentry/node"
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: "1.0.0", // any release, so the process session is sendable
skipOpenTelemetrySetup: true, // we run our own OTel pipeline elsewhere
tracesSampleRate: undefined, // tracing off
})
console.log("done; letting the process exit naturally")
Stub receiver used for the counts below:
import http from "node:http"
let n = 0
http.createServer((req, res) => { let b = ""; req.on("data", c => b += c); req.on("end", () => {
n++; console.log(n, req.url, [...b.matchAll(/"type":"([a-z_]+)"/g)].map(m => m[1]).join(","), b.slice(-160)); res.end("{}") }) }).listen(9999)
Steps to Reproduce
node stub.mjsSENTRY_DSN=http://k@localhost:9999/1 node repro.mjs
Expected Result
The process sends the session (and at most one client report) and exits.
Actual Result
The process never exits. The stub receives one session envelope and then an endless stream of client_report envelopes, each containing:
{"discarded_events":[{"reason":"no_parent_span","category":"span","quantity":1}]}
CPU sits at 60–100% against a local stub; against a real DSN the loop is network-bound but the process is still immortal. We hit this in a Cloud Run job running database migrations, which hung until its 600 s task timeout on every deploy after upgrading from 10.54.
What appears to happen:
- #23731 (10.72) makes
processSessionIntegrationend the session onbeforeExitwhen its status isok, so a healthy process now sends asessionenvelope at exit (previously the condition was inverted and healthy processes sent nothing). - That transport request is instrumented by the http integration. With no OTel setup and tracing off, its span is dropped and
recordDroppedEvent("no_parent_span", "span")records an outcome. - The client-report
beforeExitlistener flushes the new outcome → another instrumented request → anotherno_parent_spanoutcome →beforeExitagain → …
Confirmed by elimination:
| init options | result |
|---|---|
{ dsn, release } |
1 session, exits |
{ dsn, release, skipOpenTelemetrySetup: true } |
1 session + infinite client reports, never exits |
{ dsn, release, skipOpenTelemetrySetup: true, sendClientReports: false } |
1 session, exits |
| same as row 2 on 10.54.0 | nothing sent, exits |
await Sentry.close() before exiting also avoids it, but the default behaviour of a process that simply finishes should not be to hang.
Additional Context
Suggested fixes: don't record a no_parent_span outcome for the SDK's own transport requests, and/or don't re-arm the client-report flush from within a beforeExit flush (e.g. only flush outcomes that existed before the current beforeExit tick).
Priority
Medium
- 主要语言
- TypeScript
- 星标
- 8.7k
- 派生
- 1.9k
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 576
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/sentry-javascript 的其他 Issue
-
Browser Bug Next.js Traces Waiting for: Product Owner
难度 2/5 1-3 小时 新手友好度 75/100
getsentry/sentry-javascript#24672 · 1 条评论 ·
-
javascript
难度 2/5 1-3 小时 新手友好度 75/100
getsentry/sentry-javascript#24200 · 2 条评论 ·
-
javascript Task
难度 2/5 1-3 小时 新手友好度 82/100
getsentry/sentry-javascript#24134 · 1 条评论 ·
-
Cloudflare Workers javascript Tests
难度 2/5 1-3 小时 新手友好度 78/100
getsentry/sentry-javascript#24051 · 1 条评论 ·
-
Bug Bun javascript
难度 2/5 1-3 小时 新手友好度 92/100
getsentry/sentry-javascript#24045 · 1 条评论 ·
查看 getsentry/sentry-javascript 的全部 Issue
相似的 Issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
Crush 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
catppuccin/catppuccin#3125 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/cln-application#167 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Quantco/pnpm-licenses#17 ·
-
难度 2/5 1-3 小时 新手友好度 75/100