-
-
Notifications
You must be signed in to change notification settings - Fork 461
[ANR] Update Connection Status cache in the background #4832
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
Open
stefanosiano
wants to merge
8
commits into
main
Choose a base branch
from
stefanosiano/fix/anr-connection-status
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+81
−61
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…d, so lock is not acquired indefinitely
Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9fbb112 | 401.87 ms | 515.87 ms | 114.00 ms |
| b3d8889 | 371.84 ms | 447.49 ms | 75.65 ms |
| d217708 | 411.22 ms | 430.86 ms | 19.63 ms |
| 27d7cf8 | 397.90 ms | 498.65 ms | 100.75 ms |
| fcec2f2 | 311.35 ms | 384.94 ms | 73.59 ms |
| ee747ae | 358.21 ms | 389.41 ms | 31.20 ms |
| ee747ae | 554.98 ms | 611.50 ms | 56.52 ms |
| b77456b | 393.26 ms | 441.10 ms | 47.84 ms |
| 27d7cf8 | 309.43 ms | 364.27 ms | 54.85 ms |
| b3d8889 | 371.33 ms | 426.24 ms | 54.92 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 9fbb112 | 1.58 MiB | 2.11 MiB | 539.18 KiB |
| b3d8889 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
| d217708 | 1.58 MiB | 2.10 MiB | 532.97 KiB |
| 27d7cf8 | 1.58 MiB | 2.12 MiB | 549.42 KiB |
| fcec2f2 | 1.58 MiB | 2.12 MiB | 551.51 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| ee747ae | 1.58 MiB | 2.10 MiB | 530.95 KiB |
| b77456b | 1.58 MiB | 2.12 MiB | 548.11 KiB |
| 27d7cf8 | 1.58 MiB | 2.12 MiB | 549.42 KiB |
| b3d8889 | 1.58 MiB | 2.10 MiB | 535.07 KiB |
Previous results on branch: stefanosiano/fix/anr-connection-status
Startup times
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f208591 | 320.37 ms | 351.59 ms | 31.22 ms |
| 241e3d5 | 316.48 ms | 362.29 ms | 45.81 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| f208591 | 1.58 MiB | 2.12 MiB | 549.41 KiB |
| 241e3d5 | 1.58 MiB | 2.12 MiB | 549.40 KiB |
avoid concurrent cache updates
avoid concurrent cache updates
avoid concurrent cache updates
… status synchronously
# Conflicts: # CHANGELOG.md
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📜 Description
AndroidConnectionStatusProvider cache is now updated in the background, so lock is not acquired indefinitely
💡 Motivation and Context
There are a lot of ANRs in our Play console and in our own SDKCD tool, that report ANRs due to a lock in
AndroidConnectionStatusProvider.We were doing some IPC calls inside the lock, which may cause the ANR:
The problem happens when the app goes to the foreground, as our
AndroidConnectionStatusProvideronForegroundis called, which runsupdateCachein the background. At the same time, though, theReplayIntegrationrunsupdateCacheon the main thread at the same moment (when the app goes to the foreground).The ANR happens because of the mainThread awaiting the lock (it shouldn't happen, but maybe the IPC calls done in
updateCacheare the culprit)💚 How did you test it?
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps