-
Notifications
You must be signed in to change notification settings - Fork 35
Detect false-positive ANRs report and prevent ANR watchdog from sending them #66
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
Conversation
…ng them + anr thread improvements
| /// Determine if the ANR background thread should be disabled or not | ||
| /// for some time of period. | ||
| /// This option will be used by the native client implementation | ||
| /// once applicaiton goes to background/foreground |
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.
Typo here.
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.
done - thanks
Runtime/Native/iOS/NativeClient.cs
Outdated
| /// Determine if the ANR background thread should be disabled or not | ||
| /// for some time of period. | ||
| /// This option will be used by the native client implementation | ||
| /// once applicaiton goes to background/foreground |
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.
Typo
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.
done - thanks
Runtime/Native/iOS/NativeClient.cs
Outdated
|
|
||
| /// <summary> | ||
| /// Determine if the ANR background thread should be disabled or not | ||
| /// for some time of period. |
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.
period of time
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.
done - thanks.
Runtime/Native/iOS/NativeClient.cs
Outdated
| lastUpdatedCache = _lastUpdateTime; | ||
| } | ||
| else | ||
| // make sure when ANR happened just after going to foreground |
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.
These comments blocks are a bit hard to follow. I would suggest putting braces on same line or put the comment inside the block.
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.
done - thanks.
Runtime/Native/iOS/NativeClient.cs
Outdated
| /// <summary> | ||
| /// Pause ANR detection | ||
| /// </summary> | ||
| /// <param name="stopAnr">True - if native client should pause an ANR detection</param> |
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.
"should pause ANR detection"
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.
done - thanks
rqbacktrace
left a comment
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.
As you mentioned previously, we might want to see if we can unify Android/iOS ANR algorithm used by Unity here. Otherwise looks good to me!
vlussenburg
left a comment
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.
This requires a (unit) test.
a) to prove the problem exists (before the code change)
b) to verify the problem is fixed
and of course c) to show all scenarios we support.
I wish Unity can provide an easy tool to mock moving device to background and watch background thread time to synchronize them somehow - you were able to reproduce it by just closing an app in the right moment, because timer didn't stop working before main method did and timer continue counting. I wish we can test it but I can't imagine different tests than manual with current test suite and with test tools that we use. |
Check. Makes sense. |
…se-positive anrs (#69) * Background thread support (#67) * Background thread support * Fixed exception flow * Removed renamed file * Detect false-positive ANRs report and prevent ANR watchdog from sending them (#66) * Detect false-positive ANRs report and prevent ANR watchdog from sending them + anr thread improvements * Fixed typos + better documentation - added Samy's advices * Attachment support (#68) * Attachment support on Android - iOS shouldn't compile * Updated the latest version of backtrace-android libraries and also adjust iOS integration code - code should now compile on iOS * Native attachment support * Attachment improvements * Updated label * Native client updates * Android libraries * Version update * 3.4.0-rc1 * Prevents from reading empty attachments * Arabic language support (#70) * Fixed invalid date in log manager when calendar is unsupported * Use single method to generate UTC timestamps + move it from extension code to static class to avoid unnecessary allocation * Fixed line endings * Updated native library * Removed debug logs from native library * Updated library version * Added invariant culture to rest of the code * native library update * Fixed issue in the readme file * Correct attachment name (#73) * Correct attachment name * Moved constants to const variables * Prepare for final release * Fixed typo in function name * Changelog change
Why
When the user closed an application just after the ANR watchdog ANR check, the next time when an application goes from background to foreground, the ANR watchdog might report a false-positive ANR. To prevent this situation we need to also detect when an application goes to background/foreground and prevent/allow ANR checks depends on the application state.
Technical background
nativeClientinstance sets_preventAnrflag to false/true.Testing strategy
Move application to background on Android/iOS just after ANR detection method and wait more than 5 seconds
No unit tests.
Commercialization
This diff will be merged to branch release/3.3.4. After merging all technical changes we will work on the documentation/changelog improvements.