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: Detecting ANRs as false OOMs #1695

Merged
merged 28 commits into from
Mar 17, 2022
Merged

fix: Detecting ANRs as false OOMs #1695

merged 28 commits into from
Mar 17, 2022

Conversation

philipphofmann
Copy link
Member

@philipphofmann philipphofmann commented Mar 15, 2022

📜 Description

The OOM logic falsely detected ANRs as OOMs. This is fixed now by
adding a tracker for ANRs, which doesn't report ANR events to
Sentry yet.

💡 Motivation and Context

Fixes GH-1645

💚 How did you test it?

Unit tests, simulator, and on an iPhone.

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the docs if needed
  • Review from the native team if needed
  • No breaking changes

🔮 Next steps

Docs PR getsentry/sentry-docs#4837

The OOM logic falsely detected ANRs as OOMs. This is fixed now by
adding a tracker for ANRs, which doesn't report ANR events to
Sentry yet.

Fixes GH-1645
@philipphofmann philipphofmann changed the title fix: Detect ANRs as OOMs fix: Detecting ANRs as false OOMs Mar 15, 2022
@codecov-commenter
Copy link

codecov-commenter commented Mar 15, 2022

Codecov Report

Merging #1695 (5e32b7f) into master (07d46d8) will increase coverage by 0.06%.
The diff coverage is 98.82%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1695      +/-   ##
==========================================
+ Coverage   94.70%   94.77%   +0.06%     
==========================================
  Files         162      167       +5     
  Lines        7442     7579     +137     
==========================================
+ Hits         7048     7183     +135     
- Misses        394      396       +2     
Impacted Files Coverage Δ
Sources/Sentry/SentryDispatchQueueWrapper.m 100.00% <ø> (ø)
Sources/Sentry/include/SentryDependencyContainer.h 33.33% <33.33%> (ø)
Sources/Sentry/SentryANRTracker.m 100.00% <100.00%> (ø)
Sources/Sentry/SentryANRTrackingIntegration.m 100.00% <100.00%> (ø)
Sources/Sentry/SentryAppStartTrackingIntegration.m 100.00% <100.00%> (ø)
Sources/Sentry/SentryAppState.m 100.00% <100.00%> (ø)
Sources/Sentry/SentryAppStateManager.m 100.00% <100.00%> (ø)
Sources/Sentry/SentryCrashAdapter.m 76.47% <100.00%> (+3.13%) ⬆️
Sources/Sentry/SentryCrashIntegration.m 100.00% <100.00%> (ø)
Sources/Sentry/SentryDependencyContainer.m 100.00% <100.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07d46d8...5e32b7f. Read the comment docs.

Copy link
Member

@bruno-garcia bruno-garcia left a comment

Choose a reason for hiding this comment

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

8/42 files

Sources/Sentry/SentryANRTracker.m Show resolved Hide resolved
Sources/Sentry/SentryANRTracker.m Show resolved Hide resolved
Sources/Sentry/SentryANRTracker.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryANRTracker.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryANRTracker.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryANRTracker.m Show resolved Hide resolved
Sources/Sentry/SentryANRTrackingIntegration.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryANRTrackingIntegration.m Show resolved Hide resolved
Sources/Sentry/SentryANRTrackingIntegration.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryANRTrackingIntegration.m Outdated Show resolved Hide resolved
{
@synchronized(self) {
SentryAppState *appState = [self.fileManager readAppState];
if (nil != appState) {
Copy link
Member

Choose a reason for hiding this comment

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

What about the first run? Will readAppState create an empty file for us on read?

Copy link
Member Author

Choose a reason for hiding this comment

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

As we currently only use this for creating OOMs and we use it to avoid creating false OOMs, we don't need to worry about this right now, as we only create an OOM if there is an app state.

Sources/Sentry/SentryDependencyContainer.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryDependencyContainer.m Outdated Show resolved Hide resolved
Sources/Sentry/SentryDependencyContainer.m Outdated Show resolved Hide resolved
Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

Great!! Let merge this!! 🚀

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.

App hang leads to falsely reported OOM
4 participants