René's URL Explorer Experiment


Title: serialization possible freezes the capturing thread · Issue #43 · getsentry/sentry-javascript-node-native-stacktrace · GitHub

Open Graph Title: serialization possible freezes the capturing thread · Issue #43 · getsentry/sentry-javascript-node-native-stacktrace

X Title: serialization possible freezes the capturing thread · Issue #43 · getsentry/sentry-javascript-node-native-stacktrace

Description: Environment Sentry SaaS. @sentry/node: 11.5.0 @sentry/profiling-node: 11.5.0 @sentry/node-native: 11.5.0 @sentry/node-native-stacktrace: 0.5.2 (latest) Node.js 24, Linux x64 (Google Cloud Run), reproduced on macOS arm64 eventLoopBlockInt...

Open Graph Description: Environment Sentry SaaS. @sentry/node: 11.5.0 @sentry/profiling-node: 11.5.0 @sentry/node-native: 11.5.0 @sentry/node-native-stacktrace: 0.5.2 (latest) Node.js 24, Linux x64 (Google Cloud Run), rep...

X Description: Environment Sentry SaaS. @sentry/node: 11.5.0 @sentry/profiling-node: 11.5.0 @sentry/node-native: 11.5.0 @sentry/node-native-stacktrace: 0.5.2 (latest) Node.js 24, Linux x64 (Google Cloud Run), rep...

Opengraph URL: https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"serialization possible freezes the capturing thread","articleBody":"### Environment\n\n- Sentry SaaS.\n- @sentry/node: 11.5.0\n- @sentry/profiling-node: 11.5.0\n- @sentry/node-native: 11.5.0\n- @sentry/node-native-stacktrace: 0.5.2 (latest)\n- Node.js 24, Linux x64 (Google Cloud Run), reproduced on macOS arm64\n- `eventLoopBlockIntegration({ threshold: 500 })`\n\n### Steps to Reproduce\n\n`captureStackTrace()` serializes the thread's AsyncLocalStorage state without any limits. A small object graph with shared references is enough to freeze the captured thread and allocate GBs:\n\n```js\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { Worker } from 'node:worker_threads';\nimport { registerThread } from '@sentry/node-native-stacktrace';\n\nconst DEPTH = Number(process.argv[2] ?? 22);\n// Each level references the next one twice: a few hundred bytes, 2^DEPTH paths\nlet state = { leaf: 'x' };\nfor (let i = 0; i \u003c DEPTH; i++) state = { a: state, b: state };\n\nconst als = new AsyncLocalStorage();\nregisterThread({ asyncLocalStorage: als });\n\nconst flags = new Int32Array(new SharedArrayBuffer(8));\nnew Worker(`\n  const { workerData: { flags } } = require('node:worker_threads');\n  const { captureStackTrace } = require('@sentry/node-native-stacktrace');\n  Atomics.wait(flags, 0, 0);\n  const t = Date.now();\n  const trace = captureStackTrace();\n  console.log('capture took', Date.now() - t, 'ms, asyncState JSON', JSON.stringify(trace['0']?.asyncState ?? null).length, 'chars');\n  Atomics.store(flags, 1, 1);\n`, { eval: true, workerData: { flags } });\n\nals.run(state, () => {\n  Atomics.store(flags, 0, 1);\n  Atomics.notify(flags, 0);\n  while (Atomics.load(flags, 1) === 0) {} // blocked event loop\n});\nconsole.log('maxRSS', Math.round(process.resourceUsage().maxRSS / 1024), 'MB');\n```\n\n| DEPTH | capture | peak RSS |\n|---|---|---|\n| 16 | 65 ms | 130 MB |\n| 20 | 1.1 s | 799 MB |\n| 22 | 5.0 s, then times out, `asyncState` is `null` | 2.3 GB |\n\n\n1. We have investigated several memory usage spikes and OOM Errors (a few per day) on one of our services.\n2. We found Sentry EventLoopBlocked Events for every OOM kill, which didn't have any stacktrace, so with the help of AI we found that this case happens, if Sentrys Module is not able to create a Stacktrace in time (5s)\n3. We let AI make testcases for complex data in AsyncLocalStorage and analyze the behaviour of SanitizeForJSON compared to libraries which handle the cases well.\n4. We created a fix living [here](https://github.com/johannespinger/sentry-javascript-node-native-stacktrace/tree/fix/bounded-async-state-serialization ), with which we patched the current sentry module for our service\n5. Since we deployed this fixed version (4 days ago) our OOMs are fixed.\n6. We didn't want to create a PR based on this branch, cause its AI-written, but I am open to contribute if you want the PR.\n\n### Expected Result\nSerializing the state takes bounded time and memory regardless of its shape (depth, width, shared references, large strings). Getters, proxies and `toJSON` do not throw into the interrupted application code.\n\n### Actual Result\n`SanitizeForJSON` (module.cc) has no limits on depth, breadth, total values or string size. Its cycle check only compares against the current ancestor path, so shared references are copied once per path (exponential), and it runs inside the interrupted thread. Effects:\n\n- the captured thread freezes for seconds and memory grows by GBs (see table)\n- deep chains such as a Node timer list crash V8 (`Check failed: isolate_->IsOnCentralStack()`)\n- exceptions from getters, revoked proxies or `toJSON` are thrown into the application\n\nIn production this hit us through `eventLoopBlockIntegration`: its rate limit allows one event per clock hour, so the first block after hh:00 triggered a capture of the request scope. Instances froze and were OOM-killed by Cloud Run at the full hour, 2–3 times a day. Every kill had a matching `EventLoopBlocked` event without a stack trace, because the 5 s wait ran out.\n\n### Fix\n\nWe patched the addon to bound the serialization (depth 10, 1,000 entries per object, 20,000 values, 1 MiB of strings, with markers where it cuts), read only own properties, and keep exceptions out of the app thread: https://github.com/johannespinger/sentry-javascript-node-native-stacktrace/tree/fix/bounded-async-state-serialization\n\nWe've run it in production since 2026-10-08, with zero OOM kills since (before: 13 in 6 days). It was written with AI. Happy to open a PR if the approach works for you.","author":{"url":"https://github.com/johannespinger","@type":"Person","name":"johannespinger"},"datePublished":"2026-10-12T10:57:47Z","url":"https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:158abb35-23b8-914a-9ac8-1cd20a62acab
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC41A:29409B:2869A0:3885C2:6B04212A
html-safe-nonce175b4c5224b4f38dbbdba4fbbb16dc9357eab1d20452829502473a3e0bf0be9a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNDFBOjI5NDA5QjoyODY5QTA6Mzg4NUMyOjZCMDQyMTJBIiwidmlzaXRvcl9pZCI6IjIwMjAyMTY0MjQ0MjA4NzY1ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac8acbe183f237931cadf4461353c0c4618dca1cb8fe14f9529d762177d7770f31
hovercard-subject-tagissue:5812550172
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript-node-native-stacktrace/43/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2e16574d4e52932553fdd2523cbc9fe5b8b6c55f0df03ba7c1cb5ba9250430f4/getsentry/sentry-javascript-node-native-stacktrace/issues/43
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2e16574d4e52932553fdd2523cbc9fe5b8b6c55f0df03ba7c1cb5ba9250430f4/getsentry/sentry-javascript-node-native-stacktrace/issues/43
og:image:altEnvironment Sentry SaaS. @sentry/node: 11.5.0 @sentry/profiling-node: 11.5.0 @sentry/node-native: 11.5.0 @sentry/node-native-stacktrace: 0.5.2 (latest) Node.js 24, Linux x64 (Google Cloud Run), rep...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejohannespinger
hostnamegithub.com
expected-hostnamegithub.com
Nonef8d9f404447ab5df341c8a92cf5fc927730ad1321e64ac57656444d2438097f1
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-javascript-node-native-stacktrace git https://github.com/getsentry/sentry-javascript-node-native-stacktrace.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id990851629
octolytics-dimension-repository_nwogetsentry/sentry-javascript-node-native-stacktrace
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id990851629
octolytics-dimension-repository_network_root_nwogetsentry/sentry-javascript-node-native-stacktrace
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef7edccce04851591ee529948701779ce6819bc53
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript-node-native-stacktrace%2Fissues%2F43
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-javascript-node-native-stacktrace%2Fissues%2F43
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-javascript-node-native-stacktrace
Reloadhttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
Reloadhttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
Reloadhttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
getsentryhttps://github.com/getsentry
sentry-javascript-node-native-stacktracehttps://github.com/getsentry/sentry-javascript-node-native-stacktrace
Codehttps://github.com/getsentry/sentry-javascript-node-native-stacktrace
Issues2 (2)https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues
Pull requests2 (2)https://github.com/getsentry/sentry-javascript-node-native-stacktrace/pulls
Actionshttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/actions
Projectshttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/projects
Security and qualityhttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/security
Insightshttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/insights
https://github.com/getsentry/sentry-javascript-node-native-stacktrace
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
#45https://github.com/getsentry/sentry-javascript-node-native-stacktrace/pull/45
serialization possible freezes the capturing threadhttps://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43#top
#45https://github.com/getsentry/sentry-javascript-node-native-stacktrace/pull/45
https://github.com/timfish
https://github.com/johannespinger
johannespingerhttps://github.com/johannespinger
on Oct 12, 2026https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43#issue-5812550172
herehttps://github.com/johannespinger/sentry-javascript-node-native-stacktrace/tree/fix/bounded-async-state-serialization
https://github.com/johannespinger/sentry-javascript-node-native-stacktrace/tree/fix/bounded-async-state-serializationhttps://github.com/johannespinger/sentry-javascript-node-native-stacktrace/tree/fix/bounded-async-state-serialization
timfishhttps://github.com/timfish
on Oct 12, 2026https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43#event-33049897827
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-javascript-node-native-stacktrace/issues/43
timfishhttps://github.com/timfish
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.