Current tab gets reloaded on unlocking the screen
Steps to reproduce
- Load any web page that is complicated enough. I can't figure out the threshold. For my device, https://github.com/mozilla-mobile/fenix/issues/ does the trick.
- Lock the device screen and wait for a while. I believe, some 10 seconds should be enough.
- Unlock the device.
Might need to repeat steps 2 and 3 twice.
Expected behavior
The tab is displayed as it was when I left it.
Actual behavior
The tab gets blank and reloads immediately or after I scroll it a little.
Device information
- Android device: LG-M710ds, running old Android 7.0.
- Fenix version: Firefox Nightly 201210 17:02 (Build #2015780617)
- AC: 70.0.20201210143138, ae9cdf4bb
- GV: 85.0a1-20201210092800
- AS: 67.0.0
Installed add-ons
- uBlock Origin,
- Dark Reader,
- HTTPS Everywhere,
- Decentraleyes.
Without uBlock Origin enabled, the tabs rarely get reloaded. The add-on might just be the last straw or the only reason.
Comments
- Might be related to the issue https://github.com/mozilla-mobile/fenix/issues/12731. However, that one is about other tabs, not screen locking.
- When the tab goes blank, and I scroll upwards (like to the top of the page), the browser sees it like an overscrolling and reloads the tab forgetting the place I was at. That's irritating. Please, add a switch to disable reloading on overscroll.
┆Issue is synchronized with this Jira Task
We're unable to reproduce on the G5+ with ublock enabled. We'll need to try again on the Moto G5.
Without uBlock Origin enabled, the tabs rarely get reloaded. The add-on might just be the last straw or the only reason.
We've previously had performance issues with uBlock that we believe are attributable to the add-on and not the code supporting it. If you're generally only able to reproduce the issue with ublock enabled then it's probably due to the add-on using more memory. If so, you could also try raising this with the ublock developers to see if they could address the issue or have a recommendation regarding memory.
Please, add a switch to disable reloading on overscroll.
We have one: Settings -> Customize -> Gestures -> toggle Pull to Refresh. :) (I believe this gesture is only available in nightly because we haven't perfected the feel yet)
Possibly related to https://github.com/mozilla-mobile/fenix/issues/12731
Without ublock, I'm unable to reproduce on the Moto G5 using https://github.com/mozilla-mobile/fenix/issues/ including trying to turn off the screen a few times in a row and scrolling.
I'll need to try again with ublock as my device is suddenly struggling with my network.
Finally, I've got something useful.
With adb logcat -v time | grep -e Fenix -e tab, I got lots of lines like these:
01-07 21:31:11.899 I/FenixApplication(25047): onTrimMemory(), level=5, main=true
01-07 21:31:11.911 I/FenixApplication(26007): onTrimMemory(), level=5, main=false
01-07 21:31:12.064 I/FenixApplication(25047): onTrimMemory(), level=10, main=true
01-07 21:31:12.065 I/FenixApplication(26007): onTrimMemory(), level=10, main=false
01-07 21:31:13.238 I/FenixApplication(25047): onTrimMemory(), level=15, main=true
01-07 21:31:13.238 I/FenixApplication(26007): onTrimMemory(), level=15, main=false
Here, level is from 5 to 80, main is true or false. That's just like in https://github.com/mozilla-mobile/fenix/issues/12731.
However, sometimes, I got line like
01-07 21:31:16.447 I/FenixApplication(25047): onTrimMemory(), level=15, main=true
01-07 21:31:16.448 I/TrimMemoryMiddleware(25047): Trim memory (tabs=1, suspending=0)
01-07 21:31:16.452 I/FenixApplication(26007): onTrimMemory(), level=15, main=false
01-07 21:31:18.585 I/FenixApplication(26007): onTrimMemory(), level=80, main=false
01-07 21:31:18.720 I/ActivityManager(16642): Process org.mozilla.fenix:tab1 (pid 26007) has died
01-07 21:31:18.721 W/ActivityManager(16642): Scheduling restart of crashed service org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab1 in 1000ms
01-07 21:32:33.827 I/FenixApplication(25047): onTrimMemory(), level=10, main=true
01-07 21:32:33.838 I/FenixApplication(25047): onTrimMemory(), level=15, main=true
01-07 21:32:33.843 I/TrimMemoryMiddleware(25047): Trim memory (tabs=1, suspending=0)
01-07 21:33:04.955 I/ActivityManager(16642): Start proc 30163:org.mozilla.fenix:tab0/u0a463 for service org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0
That's when a tab gets reloaded. The full log of the 20 minutes before the lines above it attached. Apparently, process 26007 was not the only one to die then. I can't say whether it was a coincidence or something more. I watched ... has died messages, and there seems to be no pattern.
With the up-to-date Fenix, I can not reproduce the crash every time. I seems to occur at random. However, it might (I have no proof) be related to some Android inner life, its own services and processes.
Triage: according to the logs above, we're experiencing memory pressure. For the log of:
Scheduling restart of crashed service org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab1 in 1000ms
This is unexpected. We do close the associated sessions but crashing is unintentional.
@agi Do you have any ideas, maybe from the logs, why this is occurring?
Unfortunately it doesn't seem like we're logging anything about the crash. @StSav012 do you see anything in about:crashes by any chance? The fact that we don't seem to submit this crash is very worrying to me.
Also, are you on arm 32bit by any chance? I'm wondering if this is a variation of https://bugzilla.mozilla.org/show_bug.cgi?id=1681842
@StSav012 do you see anything in
about:crashesby any chance?
Negative, I don't see that many crash reports there. There are only five events listed for me, one (btw, OOM) from 27/11/2020, the rest are from 5 and 6 Jan 2021. I experience the tab reloading virtually every day. The newest crash report is the following:
ccf5843d-659e-4ce9-b382-ab1f4352d787
<native crash>
* Socorro: https://crash-stats.mozilla.org/report/index/bp-f2b6ce95-56f0-4a94-b257-5ffef0210106
----
<native crash>
I don't think it helps, though.
Also, are you on arm 32bit by any chance?
My device runs Qualcomm Snapdragon 435. The specs read that the CPU Architecture is 64-bit ~~to my surprise~~.
Thank you so much for your help @StSav012, I bought an LG-M710ds on Ebay, let's see if anything comes out of that.
In the meanwhile @StSav012 would you be willing to run a debug version of Fenix Nightly to see if you have the same behavior? (the debug version has a lot more logging). Completely fine if you don't want to.
@StSav012 would you be willing to run a debug version of Fenix Nightly to see if you have the same behavior?
No problem. Where can I get it?
Awesome! @StSav012 this is the ARM64 version: https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mobile.v2.fenix.debug.2021.01.15.latest.x86_64/artifacts/public/build/arm64-v8a/target.apk
I've had to install https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/mobile.v2.fenix.debug.latest.armeabi-v7a/artifacts/public/build/armeabi-v7a/target.apk, for the arm64-v8a version is not compatible with my phone.
Besides that, I used the fresh install and faced three crashed just as I locked the screen in a row. But then the crashes became much later, usually seconds or minutes after I lock the screen. I repeated the locking and unlocking several times. Here is the log: fenix-debug.log. You can see Focus left window lines in the log as the screen got locked.
Thanks @StSav012 Interestingly, there's no gecko log in that at all (for the processes that do crash) I wonder what's going on. I hope that I can reproduce locally on the device.
Triage: agi was unable to reproduce. If we have ideas of other tests, they have the same device as the reporter so we can ask them to run them.
@agi Did you have a chance to look at the crash report from https://github.com/mozilla-mobile/fenix/issues/17005#issuecomment-760907405? Does that help you get to the bottom of this issue? Here's the link: https://crash-stats.mozilla.org/report/index/f2b6ce95-56f0-4a94-b257-5ffef0210106
Unfortunately I don't think the crash is related. That crash is low volume (also already fixed in Nightly) and it doesn't seem like it would cause the effect described in this issue.
Triage: we should follow-up on https://github.com/mozilla-mobile/fenix/issues/17005#issuecomment-755832900 and check on the Moto G5 if ublock is what triggers this issue. If so, it'd be less urgent. I filed for https://github.com/mozilla-mobile/fenix/issues/18321 for this action item
In general, this may be a symptom of how much memory we use so this may fall under a larger investigation to improve memory consumption. https://github.com/mozilla-mobile/fenix/issues/17590
Excuse me, I don't really get it. While the screen is on, Firefox is fine except for rare occasions when the whole shell gets rebooted (never mind). I've disabled the screen locking, got a lot of complaining from Google. Nonetheless, when I turn the screen off (it does not lock) and wait for a while, I face the very same behavior of Firefox (currently Build #2015796361). What does the system do when the screen is off then?
@StSav012 When the screen is turned off, the application is considered backgrounded – to the app, it experiences the same code path as if the user hit the Home button to return to the homescreen and put Firefox in the background.
When the app is backgrounded, the android system reduces its priority. If the device is under heavy load, this could result in the app's process being killed to free up resources for other apps. If the process is killed, when the app is opened again (i.e. the screen is turned on), the app needs to be reloaded from disk rather than using a cached version in memory which would result in slower start ups and possibly reloading state like the page you're currently on.
I hope that makes sense. 🙂
@StSav012 I don't think we ever asked – do you happen to have a lot of apps running in the background on your device?
Note: I still need to check the ublock case locally.
Here are the outputs of adb shell dumpsys activity services and adb shell dumpsys activity.
As for uBlock Origin, the debug version of Firefox I tried did not have one, although behaved the same as the Nightly build I usually use. The debug version was used with default settings in every single aspect, and the only page I browsed to was “What's new in Firefox for Android”. So, I do not believe the add-on has much to do with the crash.
Edit. I've updated the debug build. I have not seen it crashed. However, as I have stopped many background services earlier to check the Nightly build (it still crashes), I can not call this victory yet.