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

Make sure to close all Closeable resources #3000

Merged
merged 5 commits into from
Oct 30, 2023

Conversation

stefanosiano
Copy link
Member

📜 Description

changed all stream operations to try-with-resources blocks
added super.close() to SentryFileInputStream and SentryFileOutputStream

💡 Motivation and Context

Relates to #2905
It is not fixed entirely, though. We have to investigate the native layer: removing it makes this issue disappear.

💚 How did you test it?

📝 Checklist

  • I reviewed the submitted code.
  • 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.
  • 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

@stefanosiano stefanosiano marked this pull request as ready for review October 19, 2023 09:29
@github-actions
Copy link
Contributor

github-actions bot commented Oct 19, 2023

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 404.58 ms 474.53 ms 69.95 ms
Size 1.72 MiB 2.29 MiB 577.04 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
93a76ca 378.48 ms 451.78 ms 73.30 ms
7ca9895 364.31 ms 460.46 ms 96.15 ms
86f0096 381.33 ms 476.58 ms 95.25 ms
4bf95dd 345.96 ms 414.24 ms 68.28 ms
86f0096 371.86 ms 439.78 ms 67.92 ms
0bf143e 368.35 ms 437.47 ms 69.12 ms
c7e2fbc 398.35 ms 468.52 ms 70.17 ms
93a76ca 397.30 ms 455.16 ms 57.87 ms
bc4be3b 360.40 ms 435.04 ms 74.64 ms
93a76ca 381.08 ms 459.22 ms 78.14 ms

App size

Revision Plain With Sentry Diff
93a76ca 1.72 MiB 2.29 MiB 576.75 KiB
7ca9895 1.72 MiB 2.29 MiB 576.51 KiB
86f0096 1.72 MiB 2.29 MiB 576.50 KiB
4bf95dd 1.72 MiB 2.29 MiB 576.40 KiB
86f0096 1.72 MiB 2.29 MiB 576.50 KiB
0bf143e 1.72 MiB 2.29 MiB 576.50 KiB
c7e2fbc 1.72 MiB 2.29 MiB 576.40 KiB
93a76ca 1.72 MiB 2.29 MiB 576.75 KiB
bc4be3b 1.72 MiB 2.29 MiB 576.53 KiB
93a76ca 1.72 MiB 2.29 MiB 576.75 KiB

Previous results on branch: fix/improve-closeable-handling

Startup times

Revision Plain With Sentry Diff
2e7efaf 373.88 ms 451.94 ms 78.06 ms
8887928 419.65 ms 477.52 ms 57.87 ms

App size

Revision Plain With Sentry Diff
2e7efaf 1.72 MiB 2.29 MiB 576.99 KiB
8887928 1.72 MiB 2.29 MiB 576.99 KiB

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Attention: 13 lines in your changes are missing coverage. Please review.

Files Coverage Δ
.../java/io/sentry/android/core/AnrV2Integration.java 72.52% <100.00%> (+1.25%) ⬆️
...java/io/sentry/android/core/InternalSentrySdk.java 88.17% <100.00%> (+0.12%) ⬆️
...oid/core/internal/modules/AssetsModulesLoader.java 83.33% <100.00%> (ø)
...ry/transport/apache/ApacheHttpClientTransport.java 72.44% <100.00%> (-0.28%) ⬇️
sentry/src/main/java/io/sentry/EnvelopeReader.java 90.32% <100.00%> (ø)
sentry/src/main/java/io/sentry/JsonSerializer.java 91.52% <100.00%> (+0.84%) ⬆️
...entry/internal/modules/ResourcesModulesLoader.java 66.66% <50.00%> (-13.34%) ⬇️
sentry/src/main/java/io/sentry/Hub.java 75.22% <33.33%> (-0.63%) ⬇️
...y/internal/debugmeta/ResourcesDebugMetaLoader.java 69.56% <53.33%> (-4.12%) ⬇️

📢 Thoughts on this report? Let us know!.

Copy link
Member

@markushi markushi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work! Please have a look at my comments.

removed super.close() calls from SentryFileOutputStream and SentryFileInputStream
@stefanosiano stefanosiano merged commit c3f503e into main Oct 30, 2023
19 of 21 checks passed
@stefanosiano stefanosiano deleted the fix/improve-closeable-handling branch October 30, 2023 16:36
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.

3 participants