Investigate Glean uploading issues in Android multi-process applications
Categories
(Data Platform and Tools :: Glean: SDK, task, P1)
Tracking
(Not tracked)
People
(Reporter: travis_, Assigned: travis_)
Details
Attachments
(1 file, 1 obsolete file)
VPN team brought to our attention that uploading (which relies on workmanager to perform the background task) wasn't working. This bug represents investigation of possible causes of why this is occuring.
Assignee | ||
Comment 1•2 years ago
|
||
My main theory has shifted from changes to Android 12 (API level 31) being the culprit by adding additional restrictions to the fact that multi-process support was only added to work manager after workmananger v2.5+. Since that version, new APIs and support was added to help schedule work on another process to avoid silently dropping scheduled jobs. See this article for more information: https://medium.com/androiddevelopers/workmanager-2-5-0-stable-released-701b668cd064
Assignee | ||
Comment 2•2 years ago
|
||
After doing more digging, I'm still at a bit of a loss here. The VPN app is still setting up the Configuration.Builder that WorkManager needs to run from the background process. On the suggestion of the Android team, I created a branch that ensures a unique work tag is used by the background process version of Glean, but this still didn't seem to unblock the pings from being sent.
In light of that, I've asked the VPN team if there were any changes because this used to work at one point. Perhaps a git-bisect would tell us more about this. I'm also going to try adding a background service to the glean-sample-app to better test this within the Glean repo.
Comment 3•2 years ago
|
||
Comment 4•2 years ago
|
||
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
Bea had a great hunch that the WorkManager was invoking the Glean running in the main process, which didn't have the correct data directory in order to upload the ping after it was submitted. After some experimentation with this, it looks like that hunch was absolutely right. The most recent patch attached to this bug addresses this issue by not submitting uploads to WorkManager when running in the background process, but instead using the internal Glean Dispatcher to perform the upload via a coroutine. This seems to fix the issue, as tested by both myself via the addition of a background service to the glean-sample-app, and by Bea within the VPN app. So, I think this is an acceptable solution that leaves the standard usage of WorkManager by single-process apps and by the main process of multi-process applications untouched, while fixing this issue.
Assignee | ||
Updated•2 years ago
|
Description
•