René's URL Explorer Experiment


Title: Session Replay keeps encoding segments while rate-limited and leaks MediaCodec/MediaMuxer file descriptors (EMFILE) · Issue #5529 · getsentry/sentry-java · GitHub

Open Graph Title: Session Replay keeps encoding segments while rate-limited and leaks MediaCodec/MediaMuxer file descriptors (EMFILE) · Issue #5529 · getsentry/sentry-java

X Title: Session Replay keeps encoding segments while rate-limited and leaks MediaCodec/MediaMuxer file descriptors (EMFILE) · Issue #5529 · getsentry/sentry-java

Description: Description Integration: other (sentry-android-replay) Build System: Gradle AGP Version: N/A (reported downstream via sentry-flutter, see getsentry/sentry-dart#3528) Proguard: Enabled Other Error Monitoring Solution: No Version: 8.48.3 S...

Open Graph Description: Description Integration: other (sentry-android-replay) Build System: Gradle AGP Version: N/A (reported downstream via sentry-flutter, see getsentry/sentry-dart#3528) Proguard: Enabled Other Error M...

X Description: Description Integration: other (sentry-android-replay) Build System: Gradle AGP Version: N/A (reported downstream via sentry-flutter, see getsentry/sentry-dart#3528) Proguard: Enabled Other Error M...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.113.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Session Replay keeps encoding segments while rate-limited and leaks MediaCodec/MediaMuxer file descriptors (EMFILE)","articleBody":"### Description\n\n**Integration:** other (`sentry-android-replay`)\n\n**Build System:** Gradle\n\n**AGP Version:** N/A (reported downstream via sentry-flutter, see getsentry/sentry-dart#3528)\n\n**Proguard:** Enabled\n\n**Other Error Monitoring Solution:** No\n\n**Version:** 8.48.3\n\n---\n\n## Steps to Reproduce\n\nDownstream report: getsentry/sentry-dart#3528 (Flutter app on Android, session mode replay, org under replay quota/rate limit).\n\n1. Enable Session Replay in session mode (`sessionSampleRate = 1.0`).\n2. Run the app against a DSN whose org is rate-limited for replay (server returns HTTP 429 on replay envelopes).\n3. Leave the app in the foreground for ~10+ minutes.\n4. Watch logcat: `c2.android.avc.encoder` allocate/encode/release cycles continue the whole time, each followed by `Envelope discarded due all items rate limited.` Eventually the process exhausts its FD limit (EMFILE / errno 24) and Flutter's Impeller/Vulkan rendering dies (`Could not acquire next swapchain image: ErrorOutOfHostMemory`).\n\n## Expected Result\n\nWhile rate-limited for `replay`/`all`, no segments are created or encoded, and failed/empty encodes never leak codec, surface, muxer, or file handles.\n\n## Actual Result\n\nEncoder cycles continue while the client-side rate limit is active — each segment is encoded, then immediately discarded by `RateLimiter.filter()`. Eventually the process hits its FD limit (EMFILE) and rendering dies (`ErrorOutOfHostMemory`, see downstream issue for full logs):\n\n```\nE/Sentry: ... response code 429\nD/CCodec: allocate(c2.android.avc.encoder)\n... full encode cycle ...\nW/Sentry: Envelope discarded due all items rate limited.\n```\n\n### Root cause\n\nThe rate-limit pause ([#3854](\u003chttps://github.com/getsentry/sentry-java/issues/3854>)) only stops the *recorder*; segment creation is never gated:\n\n1. `SessionCaptureStrategy.pause()` (`SessionCaptureStrategy.kt:40`) encodes a segment as part of pausing — which is then discarded client-side by definition.\n2. `RateLimiter` re-notifies observers when the limit expires (`RateLimiter.java:320`) → replay resumes → next segment is sent → 429 → pause again. This flap loops forever with no backoff, allocating encoders each round.\n3. `SessionCaptureStrategy.onScreenshotRecorded()` (`SessionCaptureStrategy.kt:74`) has no paused/rate-limited check. For hybrid SDKs (Flutter/RN), `recorder.pause()` is an async best-effort bridge call with exceptions swallowed — if it fails, a segment is encoded and discarded every 5s indefinitely.\n\n### Leaks per wasted cycle\n\n1. `ReplayCache.createVideoOf` (`ReplayCache.kt:200`): the `frameCount == 0` path returns without releasing the encoder → leaks MediaCodec, input `Surface`, and the MediaMuxer's open FD.\n2. `SimpleVideoEncoder.release()` (`SimpleVideoEncoder.kt:285`): single try block — if `drainCodec`/`stop()` throws, codec/surface/muxer are never released; exception swallowed at DEBUG.\n3. `SimpleMp4FrameMuxer.release()` (`SimpleMp4FrameMuxer.kt:69`): `muxer.stop()` throws when zero samples were written (matches `E/MPEG4Writer: Stop() called but track is not started or stopped` in the log) → `muxer.release()` skipped → leaked FD.\n4. `SentryEnvelopeItem.fromReplay` (`SentryEnvelopeItem.java:469`): the mp4 is only deleted during serialization — envelopes dropped by the rate limiter never serialize, so the replay folder grows for the whole session.\n\n### Proposed fixes\n\n1. Gate segment creation on `rateLimiter.isActiveForCategory(All/Replay)` in `SessionCaptureStrategy` before encoding. The gate must also drop/rotate incoming frames (`rotate()` only runs inside `createVideoOf`), otherwise this trades FDs for unbounded disk growth.\n2. Skip the \"pause\" segment when pausing because of rate limiting.\n3. Leak-proof teardown: release encoder on the `frameCount == 0` path; per-resource try/catch in `SimpleVideoEncoder.release()`; `try { stop() } finally { release() }` in the muxer.\n4. Delete `replayEvent.videoFile` when the envelope is dropped client-side.","author":{"url":"https://github.com/buenaflor","@type":"Person","name":"buenaflor"},"datePublished":"2026-06-11T13:14:46Z","url":"https://github.com/getsentry/sentry-java/issues/5529"}

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:ebb0cecb-9d79-dfa1-447a-c3f3743a5eed
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idBE4E:301CBB:7C97FA:AB7F5E:6B04AACD
html-safe-nonce860a73f74c01ab8a5e980d7a905d4e05484e296a97e362cdf963e7c2fe9b1f29
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTRFOjMwMUNCQjo3Qzk3RkE6QUI3RjVFOjZCMDRBQUNEIiwidmlzaXRvcl9pZCI6IjYzNjI0ODAxMzIyMTI2OTc4MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac0a151b58f9f997dc8f3e7b44f4e3541423b44dbfe3fc9dca7ac6d5478336007e
hovercard-subject-tagissue:4640804294
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/5529/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3b8688cc87136304cd40feb713b49ef3efb5c751e6666b2a3c06216ed8339ed1/getsentry/sentry-java/issues/5529
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3b8688cc87136304cd40feb713b49ef3efb5c751e6666b2a3c06216ed8339ed1/getsentry/sentry-java/issues/5529
og:image:altDescription Integration: other (sentry-android-replay) Build System: Gradle AGP Version: N/A (reported downstream via sentry-flutter, see getsentry/sentry-dart#3528) Proguard: Enabled Other Error M...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebuenaflor
hostnamegithub.com
expected-hostnamegithub.com
Nonef1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1
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
releaseffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/getsentry/sentry-java/issues/5529#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-java%2Fissues%2F5529
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%2F5529
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/5529
Reloadhttps://github.com/getsentry/sentry-java/issues/5529
Reloadhttps://github.com/getsentry/sentry-java/issues/5529
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/5529
New issuehttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/5529
Session Replay keeps encoding segments while rate-limited and leaks MediaCodec/MediaMuxer file descriptors (EMFILE)https://github.com/getsentry/sentry-java/issues/5529#top
https://github.com/romtsn
Androidhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
Bughttps://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
Replayshttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Replays%22
https://github.com/buenaflor
buenaflorhttps://github.com/buenaflor
on Jun 11, 2026https://github.com/getsentry/sentry-java/issues/5529#issue-4640804294
getsentry/sentry-dart#3528https://github.com/getsentry/sentry-dart/issues/3528
getsentry/sentry-dart#3528https://github.com/getsentry/sentry-dart/issues/3528
#3854https://github.com/getsentry/sentry-java/issues/3854
buenaflorhttps://github.com/buenaflor
Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Java%22
on Jun 11, 2026https://github.com/getsentry/sentry-java/issues/5529#event-26626835860
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Jun 11, 2026https://github.com/getsentry/sentry-java/issues/5529#issuecomment-4680946537
Linear Codehttps://linear.app
JAVA-556https://linear.app/getsentry/issue/JAVA-556
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 Jun 11, 2026https://github.com/getsentry/sentry-java/issues/5529#event-26626845877
linear-codehttps://github.com/apps/linear-code
Replayshttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Replays%22
Bughttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Bug%22
Androidhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
Javahttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Java%22
on Jun 11, 2026https://github.com/getsentry/sentry-java/issues/5529#event-26626889358
runningcodehttps://github.com/runningcode
romtsnhttps://github.com/romtsn
on Jun 19, 2026https://github.com/getsentry/sentry-java/issues/5529#event-26949911428
https://github.com/apps/linear-code
linear-codehttps://github.com/apps/linear-code
on Aug 11, 2026https://github.com/getsentry/sentry-java/issues/5529#issuecomment-5251798115
Linear Codehttps://linear.app
linear-codehttps://github.com/apps/linear-code
completedhttps://github.com/getsentry/sentry-java/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Aug 11, 2026https://github.com/getsentry/sentry-java/issues/5529#event-29272881787
Sign up for freehttps://github.com/signup?return_to=https://github.com/getsentry/sentry-java/issues/5529
Sign in to commenthttps://github.com/login?return_to=https://github.com/getsentry/sentry-java/issues/5529
romtsnhttps://github.com/romtsn
Androidhttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Android%22
Bughttps://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
Replayshttps://github.com/getsentry/sentry-java/issues?q=state%3Aopen%20label%3A%22Replays%22
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.