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

Reduce timeout of AsyncHttpTransport to avoid ANR #2879

Merged
merged 2 commits into from
Aug 4, 2023

Conversation

stefanosiano
Copy link
Member

@stefanosiano stefanosiano commented Aug 3, 2023

📜 Description

reduced timeout of AsyncHttpTransport close to flushTimeoutMillis (default 4s in Android and 15s in Java) to avoid ANRs in Android

💡 Motivation and Context

Closing the hub could cause an ANR, since the SDK would wait for 1 minute to send any cached envelope
Fixes #2864

💚 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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 9fb4dd6

@stefanosiano stefanosiano marked this pull request as ready for review August 3, 2023 10:21
@github-actions
Copy link
Contributor

github-actions bot commented Aug 3, 2023

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 333.54 ms 342.36 ms 8.82 ms
Size 1.72 MiB 2.29 MiB 575.83 KiB

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Patch coverage: 86.52% and project coverage change: +0.17% 🎉

Comparison is base (9020d1b) 81.26% compared to head (9fb4dd6) 81.44%.
Report is 41 commits behind head on feat/7.0.0.

Additional details and impacted files
@@               Coverage Diff                @@
##             feat/7.0.0    #2879      +/-   ##
================================================
+ Coverage         81.26%   81.44%   +0.17%     
- Complexity         4560     4648      +88     
================================================
  Files               350      354       +4     
  Lines             16866    17108     +242     
  Branches           2272     2313      +41     
================================================
+ Hits              13706    13933     +227     
- Misses             2219     2226       +7     
- Partials            941      949       +8     
Files Changed Coverage Δ
...racing/SentrySpanClientHttpRequestInterceptor.java 0.00% <0.00%> (ø)
...ebflux/SentryWebFilterWithThreadLocalAccessor.java 0.00% <0.00%> (ø)
...racing/SentrySpanClientHttpRequestInterceptor.java 0.00% <0.00%> (ø)
sentry/src/main/java/io/sentry/Breadcrumb.java 85.04% <ø> (ø)
sentry/src/main/java/io/sentry/HostnameCache.java 90.69% <ø> (ø)
sentry/src/main/java/io/sentry/Hub.java 75.17% <ø> (ø)
.../src/main/java/io/sentry/JsonObjectSerializer.java 84.21% <ø> (ø)
...ry/src/main/java/io/sentry/ProfilingTraceData.java 78.51% <ø> (ø)
.../main/java/io/sentry/ProfilingTransactionData.java 52.52% <ø> (ø)
sentry/src/main/java/io/sentry/Scope.java 96.72% <0.00%> (-0.36%) ⬇️
... and 82 more

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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!

@@ -140,7 +140,7 @@ public void close() throws IOException {
executor.shutdown();
options.getLogger().log(SentryLevel.DEBUG, "Shutting down");
try {
if (!executor.awaitTermination(1, TimeUnit.MINUTES)) {
if (!executor.awaitTermination(options.getFlushTimeoutMillis(), TimeUnit.MILLISECONDS)) {
Copy link
Member

Choose a reason for hiding this comment

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

@adinauer this change will also affect backend, hope that's fine

@stefanosiano stefanosiano merged commit 8e78ac3 into feat/7.0.0 Aug 4, 2023
19 checks passed
@stefanosiano stefanosiano deleted the feat/http_transport_flush_timeout branch August 4, 2023 11:15
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.

None yet

2 participants