-
Notifications
You must be signed in to change notification settings - Fork 123
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
Bug 1657292 - Ping registration off main thread #1132
Conversation
1630741
to
fa2810f
Compare
glean-core/android/src/test/java/mozilla/telemetry/glean/GleanTest.kt
Outdated
Show resolved
Hide resolved
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.
I think this is fine, since we only send built-in pings (defined in the Rust core) at startup.
This does indicate that we have a bug: custom pings that include events should also be flushed at startup because they have the same timing issues as the events. But that's a separate bug and not a live issue right now.
We already do that. |
I asked for help with profiling. Until then we shouldn't merge it. |
fa2810f
to
79d41eb
Compare
I think I detected a problematic case that's currently hidden from the user. This patch would make the behavior slightly more consistent and obvious. Consider this order of calls (Android, current code in
((1) is arbitrary user code in between those calls) Now consider this:
((2) is arbitrary user code in between those calls) If (2) is slow, custom Now consider that With this patch we guarantee that, if The same caution applies when calling from different threads. @mdboom @travis79 Please check if my analysis of the current complex async behavior is correct here and let me know if we should land this PR. Note: this was initially introduced to prevent a potential startup delay for Fenix, I am still unable to reproduce that in a profile to verify this patch helps. |
Another note: there's now a high likelyhood the tests fail (as they did on CI) because we potentially queue too many ping register tasks in tests, causing the queue to spill over. |
I modified it slightly and changed tests. |
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.
Overall, I'm pretty happy with this. I think this takes care of the possibility of losing the ping registrations due to overflowing the pre-init queue, and cuts out another source of async weirdness. Good work!
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 looks good. I agree the removed test doesn't really test anything correctly anymore.
Are there C# changes also required? Since we don't have any C# users, happy to just file a bug and handle that later.
I file one. |
Now that ping registration happens through the dispatcher this test overflow the pre-init queue, causing test failures in subsequent tests due to recorded errors.
[doc only]
7d9954a
to
c4eba55
Compare
I don't like the second commit that disables the metrics ping by setting the last sent date, awkardly.Not sure why that is necessary, at a minimum we should have a nicer way to deal with it.
Otherwise this seems to work in our tests.
We would need to take this to a test drive in Fenix to figure out if that fixes the startup delay for them.