-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Multiple instances of EmbeddedBrowserActivity can exist and run at the same time #122
Comments
Added to 3.11 because it should be a quick win and doesn't conflict with the angular upgrade. This is not a blocker for the release. |
Delayed to 3.12.0 to speed up 3.11.0 release. |
Not a blocker for 1.0.0 |
It'd be good to adopt some new practices now that we have modernised our libraries, like changing the activity class that these classes extend to another that has more functionality (FragmentActivity, AppCompatActivity, etc), then we can use callback contracts when intents are resolved. Sample. |
The
medic-android
main activity,EmbeddedBrowserActivity
does not have any launch mode set. This means that multiple instances of this activity can exist in parallel.Each of these instances will connect to the server, replicate and consume device resources. Each of these roughly equate to having the app opened in multiple tabs in the same browser.
We have no control over these tasks, we do not manage them in any capacity and do not prevent them from being created.
Users also do not have control, once "in the background" such a task is not accessible, is ignored by the app and continues to function until the app is killed and started again.
I've seen multiple instances being started with regular use a few times in development, but so scarcely that I didn't investigate. But if another app would create an intent to launch the medic-android app, this would happen on a regular basis.
To determine whether these background instances exist, I:
EmbeddedBrowserActivity
(by triggering theStartupActivity
) and launched this intentTo test whether these activities are indeed "active", I used the phone as the single client for my local server (so all incoming requests would be from this device).
I logged in with an admin account on the device and, locally, directly through couch (bypassing API), I edited a random doc.
Because the device, as an admin account, would listen for changes, I would expect to see the existent longpoll changes request be answered and immediately see a new one get created. So my log would show one REQ and one RES.
Doing such, this is what my logs looked like when I had one activity:
When I had 2 activities:
When I had 3 activities:
I have observed that the background tasks were much slower to react than the one on top, and it could even take up to 10 seconds to get all of these requests, but got them without fault, every time.
I think we should change our manifest and add some
launchmode
to ourEmbeddedBrowserActivity
(or to ourStartupActivity
) to make sure we won't get into this situation.Given that I remember seeing multiple activities in the past, without launching them intentionally, makes me think that this could happen in production and could have been happening for a while. Prevalence is undetermined, but we could probably scour some logs to see identical requests comming from the same ip at roughly the same time.
The text was updated successfully, but these errors were encountered: