Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(file-io): Do not leak SentryFileInputStream/SentryFileOutputStream descriptors and channels #4296

Merged
merged 5 commits into from
Mar 31, 2025

Conversation

romtsn
Copy link
Member

@romtsn romtsn commented Mar 28, 2025

📜 Description

  • We forgot to call close in SentryFIOStream, and were just calling delegate.close but the associated channels and file descriptors were still leaking for our streams
  • Changed addAttachment sample so it uses a FileChannel (this is how I managed to reproduce the strict mode violation)

💡 Motivation and Context

Closes #2905

💚 How did you test it?

Manually + automated

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Sorry, something went wrong.

romtsn added 2 commits March 28, 2025 15:16

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
romtsn added 2 commits March 28, 2025 15:20

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link
Contributor

github-actions bot commented Mar 31, 2025

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 455.44 ms 477.88 ms 22.44 ms
Size 1.58 MiB 2.22 MiB 655.17 KiB

Previous results on branch: rz/fix/leaked-closable-sentry-fios

Startup times

Revision Plain With Sentry Diff
09b189a 482.93 ms 520.49 ms 37.56 ms

App size

Revision Plain With Sentry Diff
09b189a 1.58 MiB 2.22 MiB 655.17 KiB

…samples/android/MainActivity.java

Co-authored-by: Stefano <stefano.siano@sentry.io>
@romtsn romtsn enabled auto-merge (squash) March 31, 2025 10:05
@romtsn romtsn merged commit de2136e into main Mar 31, 2025
33 of 34 checks passed
@romtsn romtsn deleted the rz/fix/leaked-closable-sentry-fios branch March 31, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The application crashes with StrictMode error after sentry initialization on android api 31, 32, 33.
2 participants