René's URL Explorer Experiment


Title: `FirstDrawDoneListener` still leaks one react-native-screens fragment per navigation after #5567 · Issue #6357 · getsentry/sentry-java · GitHub

Open Graph Title: `FirstDrawDoneListener` still leaks one react-native-screens fragment per navigation after #5567 · Issue #6357 · getsentry/sentry-java

X Title: `FirstDrawDoneListener` still leaks one react-native-screens fragment per navigation after #5567 · Issue #6357 · getsentry/sentry-java

Description: Integration sentry-android (through @sentry/react-native) Version sentry-android 8.61.0 (@sentry/react-native 8.31.0) Steps to Reproduce React Native app (RN 0.81.5, new architecture) with a native stack (react-native-screens 4.17.1) and...

Open Graph Description: Integration sentry-android (through @sentry/react-native) Version sentry-android 8.61.0 (@sentry/react-native 8.31.0) Steps to Reproduce React Native app (RN 0.81.5, new architecture) with a native...

X Description: Integration sentry-android (through @sentry/react-native) Version sentry-android 8.61.0 (@sentry/react-native 8.31.0) Steps to Reproduce React Native app (RN 0.81.5, new architecture) with a native...

Opengraph URL: https://github.com/getsentry/sentry-java/issues/6357

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`FirstDrawDoneListener` still leaks one react-native-screens fragment per navigation after #5567","articleBody":"### Integration\n\nsentry-android (through `@sentry/react-native`)\n\n### Version\n\nsentry-android 8.61.0 (`@sentry/react-native` 8.31.0)\n\n### Steps to Reproduce\n\n1. React Native app (RN 0.81.5, new architecture) with a native stack (`react-native-screens` 4.17.1) and `reactNavigationIntegration({ enableTimeToInitialDisplay: true })`.\n2. Push a screen onto the stack, wait for it to render, then go back. Repeat 11 times.\n3. Force a GC and take a heap dump (`am dumpheap -g`).\n\n### Expected Result\n\nThe popped `ScreenStackFragment`s are collected.\n\n### Actual Result\n\nEach push leaves one `ScreenStackFragment` and its whole native view tree in memory. On a 256 MB heap device the app ends in `OutOfMemoryError` after long sessions.\n\nCounts after a forced GC, 11 push/pop cycles:\n\n| Class | Before | After |\n|---|---|---|\n| `com.swmansion.rnscreens.ScreenStackFragment` | 3 | 14 |\n| `io.sentry.android.core.internal.util.FirstDrawDoneListener` | 1 | 12 |\n| `com.facebook.react.views.view.ReactViewGroup` | 143 | 638 |\n\nRetention path:\n\n```\nViewRootImpl\n  .mAttachInfo -> View$AttachInfo\n  .mTreeObserver -> ViewTreeObserver\n  .mOnGlobalLayoutListeners -> ViewTreeObserver$CopyOnWriteArray\n  .[n] -> FirstDrawDoneListener$2\n  .val$view -> com.swmansion.rnscreens.stack.views.ScreensCoordinatorLayout\n  .fragment -> com.swmansion.rnscreens.ScreenStackFragment\n```\n\n### Cause\n\n#5567 (fix for #5495) makes the `OnGlobalLayoutListener` call `view.getViewTreeObserver().removeOnGlobalLayoutListener(this)`. That does not work for the views `RNSentryReactFragmentLifecycleTracer` registers:\n\n1. `onDraw()` adds the layout listener to the window's `ViewTreeObserver`.\n2. A static screen has no layout pass after its first draw, so the listener does not run yet.\n3. The next layout pass comes when the screen is popped. The fragment view is already detached, so `view.getViewTreeObserver()` returns the view's own floating observer, not the window's.\n4. The remove call does nothing. The listener stays on the window's observer and keeps the detached view alive.\n\n### Fix\n\n#6152 fixes it: it posts the `OnDrawListener` removal to the main thread right after the draw and drops the layout listener. We applied the same change with patch-package (a copy of the listener in `@sentry/react-native` used by `RNSentryReactFragmentLifecycleTracer`) and ran the same test:\n\n| Class | Before | After 11 cycles |\n|---|---|---|\n| `ScreenStackFragment` | 3 | 4 |\n| `FirstDrawDoneListener` | 1 | 1 |\n| `ReactViewGroup` | 143 | 190 |\n\nThis matches `enableTimeToInitialDisplay: false`, so the leak is gone with TTID still on. The #6152 description says the old behaviour \"isn't a memory leak\" because everything dies with the activity. In a single-Activity React Native app the activity lives for the whole session, so it is an unbounded leak. We would be glad to see #6152 merged.\n","author":{"url":"https://github.com/correalm","@type":"Person","name":"correalm"},"datePublished":"2026-10-22T14:17:02Z","url":"https://github.com/getsentry/sentry-java/issues/6357"}

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:ead9b095-8cbe-160f-b99b-04da85de8118
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBA08:133E28:133EEA:1B00A0:6B046587
html-safe-nonced66052f25f2d5b16fe2c0ce5d01afbcd5d188233254f04995fdf9c7da5518af6
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTA4OjEzM0UyODoxMzNFRUE6MUIwMEEwOjZCMDQ2NTg3IiwidmlzaXRvcl9pZCI6Ijc0NDEzNDM2OTE4MjgyNTgxODMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac2a436e1587276143b8e090194a673af3925b0200c168b1c4f1784a142f90c0db
hovercard-subject-tagissue:5981122447
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-java/6357/issue_layout
twitter:imagehttps://opengraph.githubassets.com/647dd4e196d5740f4b19a555110cf7ccabe7bdc5b0bb9a87f58bf5a6543e2cb8/getsentry/sentry-java/issues/6357
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/647dd4e196d5740f4b19a555110cf7ccabe7bdc5b0bb9a87f58bf5a6543e2cb8/getsentry/sentry-java/issues/6357
og:image:altIntegration sentry-android (through @sentry/react-native) Version sentry-android 8.61.0 (@sentry/react-native 8.31.0) Steps to Reproduce React Native app (RN 0.81.5, new architecture) with a native...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecorrealm
hostnamegithub.com
expected-hostnamegithub.com
None83e4c0e58c5162177f3c161c5fbad38527ae04c11ac14980f9f9d85ae2027b1f
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-java git https://github.com/getsentry/sentry-java.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id3368190
octolytics-dimension-repository_nwogetsentry/sentry-java
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id3368190
octolytics-dimension-repository_network_root_nwogetsentry/sentry-java
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
releaseca4d07a7cef4e4b75f821dc25e7300d80c1450a9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-java/issues/6357#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-java%2Fissues%2F6357
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-java%2Fissues%2F6357
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-java
Reloadhttps://github.com/getsentry/sentry-java/issues/6357
Reloadhttps://github.com/getsentry/sentry-java/issues/6357
Reloadhttps://github.com/getsentry/sentry-java/issues/6357
getsentryhttps://github.com/getsentry
sentry-javahttps://github.com/getsentry/sentry-java
Codehttps://github.com/getsentry/sentry-java
Issues266 (266)https://github.com/getsentry/sentry-java/issues
Pull requests57 (57)https://github.com/getsentry/sentry-java/pulls
Discussionshttps://github.com/getsentry/sentry-java/discussions
Actionshttps://github.com/getsentry/sentry-java/actions
Projectshttps://github.com/getsentry/sentry-java/projects
Security and quality2 (2)https://github.com/getsentry/sentry-java/security
Insightshttps://github.com/getsentry/sentry-java/insights
https://github.com/getsentry/sentry-java
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/6357
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/6357
FirstDrawDoneListener still leaks one react-native-screens fragment per navigation after #5567https://github.com/getsentry/sentry-java/issues/6357#top
https://github.com/runningcode
AndroidSDKhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
BugIssue typehttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Bug%22
Platform: Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Platform%3A%20Java%22
https://github.com/correalm
correalmhttps://github.com/correalm
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#issue-5981122447
#5567https://github.com/getsentry/sentry-java/pull/5567
#5495https://github.com/getsentry/sentry-java/issues/5495
#6152https://github.com/getsentry/sentry-java/pull/6152
#6152https://github.com/getsentry/sentry-java/pull/6152
#6152https://github.com/getsentry/sentry-java/pull/6152
getsantryhttps://github.com/apps/getsantry
Waiting for: Product Ownerhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Waiting%20for%3A%20Product%20Owner%22
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33958761988
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#issuecomment-6342990505
Linear Codehttps://linear.app
JAVA-791https://linear.app/getsentry/issue/JAVA-791
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33958772910
github-actionshttps://github.com/apps/github-actions
Platform: Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Platform%3A%20Java%22
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33958775386
getsantryhttps://github.com/apps/getsantry
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357
linear-codehttps://github.com/apps/linear-code
AndroidSDKhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
BugIssue typehttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Bug%22
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33958868716
runningcodehttps://github.com/runningcode
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33968788966
runningcodehttps://github.com/runningcode
completedhttps://github.com/getsentry/sentry-java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33968949071
getsantryhttps://github.com/apps/getsantry
Waiting for: Product Ownerhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Waiting%20for%3A%20Product%20Owner%22
on Oct 22, 2026https://github.com/getsentry/sentry-java/issues/6357#event-33968952271
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-java/issues/6357
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/6357
runningcodehttps://github.com/runningcode
AndroidSDKhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
BugIssue typehttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Bug%22
Platform: Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Platform%3A%20Java%22
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
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.