Closed Bug 947605 Opened 11 years ago Closed 3 years ago

Seemingly loaded pages (i.e. painted) may reload when switched to after being backgrounded

Categories

(Firefox for Android Graveyard :: General, defect)

25 Branch
All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: allo, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20100101 Firefox/6.0 (Beta/Release)

Steps to reproduce:

- have a slow mobile internet connection (use up your highspeed volume)
- use i.e. twitter to open a lot of tabs
- hope the ones in background are loading while you read the foreground tab


Actual results:

- When switching to a background tab, the tab starts loading, while it apparently did nothing while it was in background.
- Even when the tab was loaded before, sometimes it starts loading again, and seems to load the full page again


Expected results:

- tabs should load in background, as they do on desktop firefox
- loaded tabs should be cached, even when they are not touched for a longer time
when the background-page did not load anything yet, i.e. still points to a t.co link and then stops loading in the background, the url of the tab is about:blank later, so it does not even restart loading when it becomes active.
Version: unspecified → Firefox 25
I wonder if this is a regression.
Since I'm not able to reproduce this issue, can you please add more details, like what device are you using, what android does the device have, and the exact build you have installed? Thank you.
Flags: needinfo?(alexander_schier)
Devices: Galaxy Nexus (Android 4.2) and Nexus 7 (Android 4.3). Firefox Version 25, latest from Google Play. (Where can i find the build number?)

Maybe regression, but the problem exists for some releases now, i only did not file a bugreport up to now. So i guess the exact build is not so relevant.

As already said, my guess is, the problem happens on slow internet connections (grps speed when the highspeed volume is used up).
It is possible that the device is low on memory and is unloading these background tabs to free up memory for the newly opened tabs.

Is the most recent background tab loaded/loading? In this scenario, it's the one that's most likely to be in memory. When testing, be sure not to try to open any other background tabs before you open the most recent background tab as you may start freeing loaded tabs to have the memory to load the tabs you've just opened.

I've also seen the change to about:blank (as per comment 1) happen, but only when I close the browser before a page actually starts loading (ex: Gecko has not yet started).
Yes, it is quite possible, that the device is low on ram and background tabs are put in android cache or however this works on firefox for android. But then at least the question is, why already rendered tabs are loaded again (from network).
On the other hand, even when the tab with rendering and so on is swapped out, loading the data should continue, shouldn't it?

and the related issue is https://bugzilla.mozilla.org/show_bug.cgi?id=947606, i reported it as seperate bug, because it may only be related in the workflow, not sure if its related in the code.
Same comment for Michael as I commented in https://bugzilla.mozilla.org/show_bug.cgi?id=947606#c3
Flags: needinfo?(michael.l.comella)
I see two potentially actionable bugs here:

#1:
> - Even when the tab was loaded before, sometimes it starts loading again, and seems to load the full
> page again

I've seen this: in my experience, I would switch to a background tab, see what looks like a fully loaded page, only to have it start reloading and redraw. I wonder why this might happen (perhaps some of the page elements, such as images, are GC'd and it needs a reload). Perhaps we can restore these elements from the on-disk cache if we don't do so already.

#2:
> when the background-page did not load anything yet, i.e. still points to a t.co link and then stops
> loading in the background, the url of the tab is about:blank later, so it does not even restart
> loading when it becomes active.

I've also seen this. Perhaps related back to bug 947606 in some way.
Flags: needinfo?(michael.l.comella)
Making this bug associated with #1 in comment 8, and requesting repro steps. I most frequently have seen this when opening a large number of tabs and having them loaded simultaneously. I imagine having a device with less RAM would make this easier to repro.

I've seen this for a while, so I'm also removing the regression window request. 

bug 956794 was created for #2 in comment 8.
OS: Linux → Android
Hardware: x86_64 → All
Summary: Firefox stops loading tabs in background → Seemingly loaded pages (i.e. painted) may reload when switched to after being backgrounded
(In reply to Michael Comella (:mcomella) from comment #8)
> I see two potentially actionable bugs here:
> 
> #1:
> > - Even when the tab was loaded before, sometimes it starts loading again, and seems to load the full
> > page again
> I've seen this: in my experience, I would switch to a background tab, see
> what looks like a fully loaded page, only to have it start reloading and
> redraw. I wonder why this might happen (perhaps some of the page elements,
> such as images, are GC'd and it needs a reload). Perhaps we can restore
> these elements from the on-disk cache if we don't do so already.

Exactly this. Seeing the content for a short time, then the page starts reloading.
Flags: needinfo?(alexander_schier)
I see this as well
Device: Kobo Arc (Tablet, 7", 1 GB RAM, currently 420 MB RAM free, Android 4.1.1)
Firefox 23

Reproduction:
1. Go to news.google.de
2. Open 5 news articles as background tasks
3. Switch to one of them. (It's not loaded yet, thus:)
4. Switch to another one of them. (It's not loaded yet either, thus:)
5. Wait for page to load from network
6. Read the article
7. Switch to page from step 3.
8. Wait for page to load from network (!)
9. Read the article
10. Switch back to a previous tab that was already loaded, rendered and I had already read
    (It's not loaded anymore!, thus:)
11. Wait for page to load (apparently from network!)

Actual result:
* Pages load when I switch to the tab, not when I open the tab
* Pages that were already loaded get dropped from RAM and reload when I switch back to the tab

Expected result:
* As soon as I load a tab in the background, it starts loading from network, and also renders in background (only if there are free CPU cycles)
* If I opened a tab and a page rendered, it stays loaded, unless all RAM is depleted.
* If all RAM is depleted, the rendered page is dropped, but my input (input field values, scroll position) is saved and the network resources are cached on disk, so that they don't have to be reloaded from network
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Status: ASSIGNED → NEW
The steps in comment 11 don't work for me on my Galaxy Nexus (all pages are loaded and stay loaded), however I imagine this is dependent on the size of the content loaded from the network and the RAM of the device. Thus, to consistently repro, we'd at least need specific URLs (with non-changing content, e.g. no dynamic ads) on a specific device, though background Android processes will make this difficult still.

In any case, it'd probably worthwhile to get a video of the behavior.
I think this is more dependent on the device and its installed apps than the specific URLs, yes. I got this with several different news sites, and I often got this behaviour.
Yeah, this sounds like Android is sending a low-memory notification and Firefox is trimming the tabs. You could look in logcat for any "low memory" related output.
(In reply to Ben Bucksch (:BenB) from comment #11)
Ah, when you're saying it ... i had a similiar Bug, when i clicked some Background Tab, and the loaded page is shown, then a short flash of my tab homepage, then the page loads again.

Not sure if from session restore, or tabs loaded in background, i need to watch out for this.

I thought its a bug of my newtab page (speeddial addon), but maybe its related.
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → INCOMPLETE
Product: Firefox for Android → Firefox for Android Graveyard

Removing steps-wanted keyword because this bug has been resolved.

Keywords: steps-wanted
You need to log in before you can comment on or make changes to this bug.