-
Notifications
You must be signed in to change notification settings - Fork 4
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
App shows a black screen when restarting the app during metadata download #769
Comments
I have this here, but it hasn't finished downloading the pack when I got the black screen and it's not going away. |
I was able to reproduce this on ChromeOS but not pure Android. I'm pretty confident this is particular to the Android app and it looks like it's a lifecycle issue. On Android when you dismiss the app by swiping it away, Android kills it. On ChromeOS, it appears that it tries to destroy the app and waits a while for it to happen. This is a problem right now because Kolibri doesn't actually stop the downloads running in the background. So, when you reopen the app, it will sit at the empty webview because the activity hasn't actually stopped. If you actually wait for a while, it will eventually start. What happens is that ChromeOS finally steps in and kills the process and then starts the activity again. This should be much better in Kolibri 0.16.0-beta4 since learningequality/kolibri@6562962 will actually stop the downloads and the activity will be destroyed quickly. That just got released, so I'm going to test it out. |
I tried out 0.16.0-beta4 and it does indeed shut down much faster. However, the scheme in place to restart canceled jobs fails due to learningequality/kolibri#11169. We never hit that before because Kolibri wasn't actually canceling the jobs. Well, they're going to try to release beta5 in a day or two, so I'm going to try to hustle in a fix for that upstream. |
With 0.16.0-beta4 and learningequality/kolibri#11170 it works a lot better, but I can still get the black screen if I cycle it too fast. I don't think there's a lot more we can do without rearchitecting the app with chaquopy to be a proper Android app. |
I think I understand what's going on, and it's a limitation of python-for-android. python-for-android runs a single python interpreter in a process that runs a single script until completion. If it tries to start another python interpreter, bad things happen (this is actually a general python problem). Therefore, when the activity is being destroyed, p4a kills its own process to ensure that it can't come back and try to start another python interpreter from the same process. However, the activity manager operates differently. If the activity process is still alive, it will try to start another activity instance in that process. When you close the window, you start destroying the activity instance. If you open the app again before the activity has finished destroying, the activity manager will see the existing process and try to start another activity instance in it. Meanwhile, when the existing p4a activity instance gets done destroying itself, it kills its own process. If ChromeOS has already sent the signal to start the activity again, it thinks everything is fine. In actuality, it sits there with an empty window. If you minimize the window and open it again, ChromeOS activates the task again and this starts things going with a whole new process. So, I think this is an unsolvable issue with python-for-android. Chaquopy approaches this differently by running one python interpreter for the lifetime of the process. You can then call into the interpreter to run python code instead of a single blocking script. That said, I think kolibri 0.16.0-beta5 makes it more reliable by actually stopping the tasks correctly. Still, Kolibri doesn't stop quickly, so there's a decent window between the app stopping and actually killing the process. If you try to restart the app within that window, you can probably get the black screen. |
This release fixes cancelling of tasks so that stopping the worker instance actually stops the running tasks instead of waiting until they complete. The patch is no longer needed since it was merged upstream. Helps: endlessm/kolibri-explore-plugin#769
This release fixes cancelling of tasks so that stopping the worker instance actually stops the running tasks instead of waiting until they complete. The patch is no longer needed since it was merged upstream. Helps: endlessm/kolibri-explore-plugin#769
@vanessa-chang can you test this out and see if it behaves any better? I don't think this can be fully solved, but I think it should be harder to get into that state. |
@dbnicholson I remembered I can still reproduce the issue yesterday in Manatee 6.44-397, but I didn't pay too much attention on that. I feel that #740 is less reproduced if I recall it correctly. I will check both issue once the app is working. |
@dbnicholson I've tested the latest 6.46.401: The black screen can still be observed, but it happens at the 2nd time of re-starting the app. |
Tested the latest package, 6.47.402: The blackscreen can be reproduced, but it will not be recovered after 1.5 minutes unless you refresh the app. |
OK, I have 2 questions.
|
i. Not really. Because we have changed the way the metadata is downloaded for #739 after the production is released. ii. I have tried the APK, it works pretty well and the black screen cannot be reproduced. (Note: I cannot access the welcome screen, but it will go downloading the inventor pack after I restart the app. ) |
Tested the latest package, Narwhal 7.0-405, It works pretty much like 6.47.402. |
Talking to Vanessa, we are fine with living with that issue for now. Is not as severe and often anymore. |
With the conversion to chaquopy landed now in endlessm/kolibri-installer-android#185, I think this is testable again. I ran this on my Chromebook and didn't have any issues with the black screen. I was able to close the app and restart it while there were background downloads happening. I also couldn't get a black screen when minimizing and restoring the window. It will show up as a white screen (the browser's @vanessa-chang could you QA this again with 420 Narwhal 7.8 from internal testing? |
@dbnicholson thanks. I have tested this with Narwhal 7.8, I cannot reproduce this issue. I will close this issue. |
The app would show a black screen for around 1.5 minutes when restarting the app during metadata download.
Step to reproduce:
Actual result:
The app displays a black screen for around 1.5 minutes.
Log:
blackscreen_log.txt
*Note: This issue cannot be reproduced in the Windows version.
The text was updated successfully, but these errors were encountered: