-
-
Notifications
You must be signed in to change notification settings - Fork 446
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 descriptor leak in FileIO instrumentation #2248
Fix file descriptor leak in FileIO instrumentation #2248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you very much for fixing this bug!
sentry/src/main/java/io/sentry/instrumentation/file/SentryFileInputStream.java
Outdated
Show resolved
Hide resolved
sentry/src/main/java/io/sentry/instrumentation/file/SentryFileOutputStream.java
Outdated
Show resolved
Hide resolved
…InputStream.java Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
…OutputStream.java Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
Codecov ReportBase: 80.64% // Head: 80.62% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2248 +/- ##
============================================
- Coverage 80.64% 80.62% -0.03%
- Complexity 3366 3368 +2
============================================
Files 240 240
Lines 12382 12388 +6
Branches 1646 1646
============================================
+ Hits 9986 9988 +2
- Misses 1787 1791 +4
Partials 609 609
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
📜 Description
There is a bug in FileIO tracing that causes leak in file descriptors.
The bug affects Android and Java.
💡 Motivation and Context
The context and all the information is here.
When we create
new SentryFileInputStream(file)
ornew SentryFileOutputStream(file)
, 2 file descriptors are opened. But when we close the stream, only one is closed. The cause is in this comment.💚 How did you test it?
Run the code below in the sample app. Before fix I see lsof still shows 10 open files even though they are closed. After fix - nothing shows up.
📝 Checklist