Open Bug 1752594 Opened 4 years ago Updated 3 days ago

[meta] Tabs reload too often in Firefox for Android

Categories

(GeckoView :: General, defect, P2)

Unspecified
All
defect

Tracking

(Not tracked)

People

(Reporter: owlish, Assigned: kaya, NeedInfo)

References

(Depends on 29 open bugs, Blocks 4 open bugs)

Details

(Keywords: meta, Whiteboard: [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation][android-tab-reloading])

When switching between tabs, the tabs reload much more often than users would expect.

Github issues with more information: https://github.com/mozilla-mobile/fenix/issues/9039 and https://github.com/mozilla-mobile/fenix/issues/12731. The discussions are summarized here https://docs.google.com/document/d/1oAlGdeDHFRm886bPpFt8GxgSoXfeFiBEffc-MxdOePE/edit?usp=sharing

Lines of investigation:

  • Possible state management bug in AC where tabs are unloaded
  • Possible incorrect prioritization or management of processes by Gecko and/or incorrect relay of those priorities to Android by GV
  • Possible high memory consumption by WebRender
Depends on: 1752622
Depends on: 1752626
Depends on: 1752628
Depends on: 1752631
Depends on: 1752632
Depends on: 1752635
Depends on: 1752637
Depends on: 1682319
No longer depends on: 1682319
See Also: → 1682319
Depends on: 1750878
Depends on: 1745996

You could add https://github.com/mozilla-mobile/fenix/issues/23140#issuecomment-1011494757, Fenix process killed due to "excessive CPU".

I see this several times a day on my Samsung Galaxy M32. Might be a Samsung only issue?

Depends on: 1753700
Depends on: 1764998
Depends on: 1686116
See Also: 1682319
Severity: -- → N/A
Priority: -- → P3
Depends on: 1777506
Depends on: 1795105
Priority: P3 → P2
Whiteboard: [geckoview:2022q4]
Assignee: nobody → kkaya
Priority: P2 → P1
Whiteboard: [geckoview:2022q4] → [geckoview:2022q4] [geckoview:m109]
See Also: → 1613227
Depends on: 1619414
Whiteboard: [geckoview:2022q4] [geckoview:m109] → [geckoview:2022q4] [geckoview:m109] [geckoview:m110]

Moving this meta bug out of the sprint. Kaya will file new bugs for his specific areas of investigation.

Priority: P1 → P2
Whiteboard: [geckoview:2022q4] [geckoview:m109] [geckoview:m110] → [geckoview:2022q4] [geckoview:m109]
Depends on: 1804862
Depends on: 1804863
Depends on: 1804868

FWIW on my Galaxy M32 6 GB Android 13, Fenix tabs stay loaded pretty well but if I I go App Info > Battery and change it from Optimised to Restricted it becomes awful, it won't reliably keep 4 tabs loaded. I just wonder if some of the users who are really badly affected have Battery Restricted set, either by user intervention or by OEM design.

I think Battery Restricted is aka "restrict app use in the background", it says notifications might be delayed.

In the Restricted case the task killer becomes incredibly aggressive even if I have lots of free memory as shown in Settings > Developer Options > Running Services > Show cached processes. Open 4 tabs in Fenix; put Fenix in the background; lock phone; wait 30 seconds; unlock phone and usually one or all Fenix processes have been killed.

This is me trying to keep 4 tabs loaded in Fenix with very light/zero use of other apps, when App Info > Battery is Restricted. It's brutal.

12-12 09:47:33.950 1427 1479 I ActivityManager: Killing 6240:org.mozilla.fenix:tab25/u0a275 (adj 930): cached idle & background restricted
12-12 09:47:33.952 1427 1479 I ActivityManager: Killing 3394:org.mozilla.fenix/u0a275 (adj 910): cached idle & background restricted
12-12 09:47:33.954 1427 1479 I ActivityManager: Killing 6469:org.mozilla.fenix:gpu/u0a275 (adj 920): cached idle & background restricted
12-12 09:47:33.955 1427 1479 I ActivityManager: Killing 7253:org.mozilla.fenix:media/u0a275 (adj 935): cached idle & background restricted
12-12 09:47:33.955 1427 1479 I ActivityManager: Killing 6675:org.mozilla.fenix:tab7/u0a275 (adj 950): cached idle & background restricted
...
12-12 10:06:59.921 1427 1479 I ActivityManager: Killing 11152:org.mozilla.fenix:gpu/u0a275 (adj 900): cached idle & background restricted
12-12 10:06:59.924 1427 1479 I ActivityManager: Killing 12120:org.mozilla.fenix:media/u0a275 (adj 935): cached idle & background restricted
12-12 10:06:59.924 1427 1479 I ActivityManager: Killing 12653:org.mozilla.fenix:utility/u0a275 (adj 920): cached idle & background restricted
12-12 10:06:59.925 1427 1479 I ActivityManager: Killing 11100:org.mozilla.fenix:tab32/u0a275 (adj 960): cached idle & background restricted
...
12-12 10:09:29.575 1427 1479 I ActivityManager: Killing 12901:org.mozilla.fenix:gpu/u0a275 (adj 930): cached idle & background restricted
12-12 10:09:29.579 1427 1479 I ActivityManager: Killing 13013:org.mozilla.fenix:tab16/u0a275 (adj 900): cached idle & background restricted
...
12-12 10:15:01.679 1427 1479 I ActivityManager: Killing 13498:org.mozilla.fenix:gpu/u0a275 (adj 900): cached idle & background restricted
12-12 10:15:01.683 1427 1479 I ActivityManager: Killing 11569:org.mozilla.fenix:tab15/u0a275 (adj 920): cached idle & background restricted
...
12-12 10:59:30.056 1427 1479 I ActivityManager: Killing 20180:org.mozilla.fenix:gpu/u0a275 (adj 900): cached idle & background restricted

This does not happen if App Info > Battery is set to Optimised

Cheers & hope it's helpful

Severity: N/A → S3
Depends on: 1807364

Opened https://github.com/mozilla-mobile/fenix/issues/28452 which is a re-opening of https://github.com/mozilla-mobile/fenix/issues/23140 (closed by stalebot).
It's still a problem for me on a couple of Samsung devices.

(In reply to Mark from comment #4)

FWIW on my Galaxy M32 6 GB Android 13, Fenix tabs stay loaded pretty well but if I I go App Info > Battery and change it from Optimised to Restricted it becomes awful, it won't reliably keep 4 tabs loaded. I just wonder if some of the users who are really badly affected have Battery Restricted set, either by user intervention or by OEM design.

I think Battery Restricted is aka "restrict app use in the background", it says notifications might be delayed.

In the Restricted case the task killer becomes incredibly aggressive even if I have lots of free memory as shown in Settings > Developer Options > Running Services > Show cached processes. Open 4 tabs in Fenix; put Fenix in the background; lock phone; wait 30 seconds; unlock phone and usually one or all Fenix processes have been killed.

This is me trying to keep 4 tabs loaded in Fenix with very light/zero use of other apps, when App Info > Battery is Restricted. It's brutal.

12-12 09:47:33.950 1427 1479 I ActivityManager: Killing 6240:org.mozilla.fenix:tab25/u0a275 (adj 930): cached idle & background restricted
12-12 09:47:33.952 1427 1479 I ActivityManager: Killing 3394:org.mozilla.fenix/u0a275 (adj 910): cached idle & background restricted
12-12 09:47:33.954 1427 1479 I ActivityManager: Killing 6469:org.mozilla.fenix:gpu/u0a275 (adj 920): cached idle & background restricted
12-12 09:47:33.955 1427 1479 I ActivityManager: Killing 7253:org.mozilla.fenix:media/u0a275 (adj 935): cached idle & background restricted
12-12 09:47:33.955 1427 1479 I ActivityManager: Killing 6675:org.mozilla.fenix:tab7/u0a275 (adj 950): cached idle & background restricted
...
12-12 10:06:59.921 1427 1479 I ActivityManager: Killing 11152:org.mozilla.fenix:gpu/u0a275 (adj 900): cached idle & background restricted
12-12 10:06:59.924 1427 1479 I ActivityManager: Killing 12120:org.mozilla.fenix:media/u0a275 (adj 935): cached idle & background restricted
12-12 10:06:59.924 1427 1479 I ActivityManager: Killing 12653:org.mozilla.fenix:utility/u0a275 (adj 920): cached idle & background restricted
12-12 10:06:59.925 1427 1479 I ActivityManager: Killing 11100:org.mozilla.fenix:tab32/u0a275 (adj 960): cached idle & background restricted
...
12-12 10:09:29.575 1427 1479 I ActivityManager: Killing 12901:org.mozilla.fenix:gpu/u0a275 (adj 930): cached idle & background restricted
12-12 10:09:29.579 1427 1479 I ActivityManager: Killing 13013:org.mozilla.fenix:tab16/u0a275 (adj 900): cached idle & background restricted
...
12-12 10:15:01.679 1427 1479 I ActivityManager: Killing 13498:org.mozilla.fenix:gpu/u0a275 (adj 900): cached idle & background restricted
12-12 10:15:01.683 1427 1479 I ActivityManager: Killing 11569:org.mozilla.fenix:tab15/u0a275 (adj 920): cached idle & background restricted
...
12-12 10:59:30.056 1427 1479 I ActivityManager: Killing 20180:org.mozilla.fenix:gpu/u0a275 (adj 900): cached idle & background restricted

This does not happen if App Info > Battery is set to Optimised

Cheers & hope it's helpful

Tried that, it didn't make any difference

Depends on: 1810550
No longer depends on: 1810550
Depends on: 1810550
Depends on: 1796483
Depends on: 1812691
Depends on: 1820211
Depends on: 1820263
Whiteboard: [geckoview:2022q4] [geckoview:m109] → [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation]

Bug 1847566 is to investigate the browser primary attribute being set in GeckoView during setFocused calls. Not sure if there is any relevance to tab reloading, but it does seem like it has the potential for visible tabs to be de-prioritized if they are not marked primary and should be.

See Also: → 1847566
See Also: → 1813880
See Also: → 1841465
Depends on: 1853557
Depends on: 1853493
Depends on: 1812359
Depends on: 1853107
See Also: → 1812127
See Also: → 1809867
Depends on: 1859857
Depends on: 1859848
See Also: → 1826718
Depends on: 1859846
Depends on: 1864613
Depends on: 1867815
Depends on: 1834120
Depends on: 1811594
See Also: → 1807077
Depends on: 1870302
Duplicate of this bug: 1870433

tl;dr

Just to say I am not affected by this bug. For me, Firefox 120 and Nightly 122 are bullet proof. My phones are nothing special, 4 GB Galaxy A40 and 6 GB Galaxy M32. But I can keep eg 8 tabs open for days, swap to several other apps, come back, I never, ever see tab reloads.

Of course I can force tabs to reload if I open lots and lots of other apps, but I have to open an unrealistic number, eight or ten. Just using Firefox, swapping to Aqua Mail then Signal then Acrobat then Gallery and back to Firefox never ever causes a reload of the frontmost tab.

I'm aware of three Android mechanisms which could force a reload when Firefox comes back to the foreground. Firefox 120 is pretty well behaved with respect to all of them, and none of them should really be an issue on a fast phone with 8 GB like an S21. Hmmmm. Perhaps there's a fourth mechanism, or perhaps there's a bug in Firefox which only hits some users/phones.

I might do some more diagnosis, I've got quite good at digging around in log messages and have found a couple of issues which Mozilla has now fixed. But I need a problematic phone and/or reliable steps to reproduce, which I don't currently have.

(I don't work for Mozilla so please don't shout at me, I am just Some Guy on the Internet).

Are there any patterns?

  • what devices are you using? (I'm on mid range Samsungs)
  • how many tabs do you have open? (me, typically 4-8)
  • when you swap to another app then back to Firefox and get a reload, how long have you been away from Firefox? Seconds or minutes?
  • when you get a reload issue, which tabs reload:- all / exactly half / just the frontmost one / Firefox has been completely killed and relaunches?
  • are any sites particularly badly affected, some form fill ins seem particularly bad?
  • any funny add ons? (me, just uBO with a lot of filters and Google Search Fixer)

IIRC users were having problems on Galaxy S8; now I hear a problem on an S21. Does this only occur on Samsung flagships? Does it only occur on particular websites? Does anyone want to buy me an S21?

I even blew the dust of my Sony Xperia with Android 8 and 2.5 GB of RAM and Firefox 120 behaved pretty well, comparable to Edge. As long as I didn't go crazy it kept tabs loaded pretty well.

Background stuff

I'm aware of three mechanisms that could cause tab reloading. Perhaps there's a fourth of which I am not aware. (PS I am no expert in this stuff)

  1. voluntary RAM release through onTrimMemory. As memory pressure increases, Android requests the apps which are nearing the top of the Least Recently Used list to reduce their RAM. Firefox 120 is pretty well behaved about how it releases RAM, it unloads tabs gently in a way which keeps the front tab alive longest. But anyway this shouldn't be an issue on an 8 GB phone, Firefox should never get near the top of the LRU list unless the user goes crazy eg backgrounds Firefox and opens a dozen apps.

  2. forced kill by lmkd. If the memory pressure is still too great, Android's low memory killer daemon starts to kill processes near the top of the LRU list. Firefox 120 has a main process and two content processes, so an lmkd kill unloads exactly half your tabs; all your tabs; or kills the whole browser. Again lmkd should never get anywhere near Firefox, it shouldn't be anywhere near the top of the LRU list. Recent Samsung devices have their own ChimeraAggressivePolicyHandler which seems to replace lmkd but it does roughly the same thing.

  3. forced kill due to excessive CPU. More recent versions of Android are very strict on background CPU use. Android will kill a background app if it eg uses more than 2% CPU in a five minute interval. Firefox is not yet perfect in this regard, I have seen "excessive CPU" kills but (a) Firefox has to be in the background a long time (minutes); (b) the kills are in my experience extremely rare, perhaps once a day; and (c) with a high performance CPU like in an S21, Firefox shouldn't hit that excessive CPU kill threshold very often. There's a fix coming for excessive CPU kills but it's quite some way away.

So, are your tabs being unloaded by one of these Android mechanisms; by an unrelated bug in Firefox; or by a fourth kill Android mechanism? Hmmmm.

Do you use Private Browsing mode exclusively, Mark? If not, try to see if it gets you the bug.

For me, merely locking the device after leaving a page open can be enough to trigger a refresh upon unlocking. And this forces me to reload the entire app anyway, since the automatic page refresh doesn't restart crashed/closed extensions yet (which will probably be fixed by MV3). This is on a 3 GB device, with around 1.5 used just by the OS. However, even with everything running, I'm shown around 1GB free, which is why this behaviour seems like a Fenix bug and not simply Android freeing up RAM.

Flags: needinfo?(mark.paxman99)
Depends on: 1820223
Duplicate of this bug: 1871484

@zesanup, Private Browsing is just fine on my Xperia X Compact with 2.5 GB. I tried with and without add-ons, all fine. No reloads unless I go crazy with other apps. Definitely no reloads on unlocking the phone. I tried pretty hard over a day.

If I keep 4-6 tabs open in Firefox I never see reloads for "light use", messaging, mail etc. If I've used several other apps, when I bring Firefox back to the foreground the whole browser repaints (tab bar plus content) REALLY slowly, taking perhaps 1 second. But it's always a repaint, not a reload.
If I open some big apps, eg the Camera app and then Photos, Firefox sometimes gets killed completely and relaunches from the splash screen, and the pages reload. But that seems reasonable.

I was able to put 4 tabs in Firefox and 4 tabs in Edge and run them head to head and they both behaved as expected, if I start opening other apps, the Least Recently Used of Firefox/Edge gets killed and relaunches with a splash screen.

Right now I can't really see any real difference between Firefox and Edge in terms of page load speed or memory pressure handling. That wasn't the case a year or two ago when IME Firefox was terrible compared to Chrom(ium).

Flags: needinfo?(mark.paxman99)

(Another long post, sorry)

Santa brought me an S21 FE 6 GB and it has less free RAM than my M32 6 GB :( I think the Android system uses so much more RAM because of all the Samsung bloatware. The S21 FE definitely reloads tabs more often than the M32, especially if I open the Camera app. But the reload occurs on both Samsung Internet (Chromium) and Fenix Nightly.

I think it's Issue 2 from bug 1752594 comment 12, even on a phone with plenty of RAM, memory is in short supply and lmkd is quite aggressive. And the foreground tab in current builds of Fenix is more vulnerable to lmkd than Chromium because Fenix has only two large tab processes each containing many tabs whereas Chromium has one process per tab. If lmkd gets aggressive with Fenix it can kill both tab processes, which causes the foreground tab to reload. If lmkd gets aggressive with Chromium it is more granular, it kills tabs one by one starting with the least-recently-used, and usually lmkd is satisfied that enough RAM has been released before it gets to the foreground tab.

Fenix also has a GPU process (fenix:gpu) and an add-ons process which I think is listed like a tab process (fenix:tabxx).

Example log below of me running Samsung Internet and Fenix Nightly head to head, then opening a few apps ending up with the Camera app. Samsung Internet has two tabs killed, but not the foreground tab. Fenix has both tab processes, the gpu process and the add-ons process killed, so every tab reloads including the foreground one.

But I think this problem is substantially fixed by enabling Fission on Fenix (I expect devs would not recommend this yet). Fission gives one process per tab and I think behaves much more like Chromium, lmkd can be more granular in its tab killing. I'm not 100% sure on this, still testing.

@devs, I worry about the add-ons process, which IIUC doesn't exist in Chromium. I think the add-ons process often falls to the point in the Least Recently Used list where it is very vulnerable to an lmkd kill, and IIUC if the add-ons process gets killed, every tab in Fenix reloads. So Fenix might have a kind of dead man's handle process which isn't present in Chromium, if lmkd kills the dead man's handle process all the tabs die including the foreground tab. I think I have seen this happen but don't have a log. (Perhaps I misunderstand how this all works).

12-30 15:49:00.524   731   731 I lmkd    : Reclaim 'com.samsung.android.scs' (23149), uid 10101, oom_score_adj 945, state 19 to free 80620kB rss, 32752kB swap; reason: low watermark is breached and swap is low (2310952kB < 419428kB)
12-30 15:49:00.579   731   731 I lmkd    : Reclaim 'com.google.android.gms' (23466), uid 10238, oom_score_adj 935, state 19 to free 132912kB rss, 32904kB swap; reason: low watermark is breached and swap is low (2310952kB < 419428kB)
12-30 15:49:00.626   731   731 I lmkd    : Reclaim 'com.sec.android.app.sbrowser.beta:sandboxed_process0:org.chromium.content.app.SandboxedProcessServ' (21971), uid 99058, oom_score_adj 980, state 98 to free 119884kB rss, 45140kB swap; reason: low watermark is breached and swap is low (2311464kB < 419428kB)
12-30 15:49:00.689   731   731 I lmkd    : Reclaim 'com.sec.android.app.sbrowser.beta:sandboxed_process0:org.chromium.content.app.SandboxedProcessServ' (24014), uid 99060, oom_score_adj 970, state 98 to free 163888kB rss, 37660kB swap; reason: low watermark is breached and swap is low (2319400kB < 419428kB)
12-30 15:49:00.743   731   731 I lmkd    : Reclaim 'org.mozilla.fenix:tab39' (23760), uid 10342, oom_score_adj 940, state 17 to free 246644kB rss, 35240kB swap; reason: low watermark is breached and swap is low (2319656kB < 419428kB)
12-30 15:49:01.253   731   731 I lmkd    : Reclaim 'org.mozilla.fenix:tab11' (17635), uid 10342, oom_score_adj 930, state 17 to free 190160kB rss, 128872kB swap; reason: low watermark is breached and swap is low (2320680kB < 419428kB)
12-30 15:49:01.415   731   731 I lmkd    : Reclaim 'org.mozilla.fenix:tab29' (5234), uid 10342, oom_score_adj 920, state 17 to free 95684kB rss, 141216kB swap; reason: low watermark is breached and swap is low (2437160kB < 419428kB)
12-30 15:49:01.462   731   731 I lmkd    : Reclaim 'org.mozilla.fenix:gpu' (23650), uid 10342, oom_score_adj 910, state 17 to free 174704kB rss, 33460kB swap; reason: low watermark is breached and swap is low (2512000kB < 419428kB)

Not sure how helpful this will be for the developers, but on my Galaxy S8+ with 4Β GB of RAM (Android 9), I could vastly improve Firefox's tab β€œlongevity” in the background by having some sort of media playback running or at least by having Firefox β€œdetect” some sort of playback.

For example, I used this site's sine wave player (audiocheck.net) to test this. You don't have to keep playing the 1000Hz sine wave audio, just press play once and then pause it, and the trick should still work. Having Firefox detect media playback in the background helped me keep a very reload-happy site from getting killed as soon as I left the app. It's not 100% perfect, tabs can still get killed if I push multitasking too hard on my 4 GB phone, but keep in mind I'm running my Firefox with a ton of add-ons.

The catch is that the media playback needs to be running from the same β€œshared” web process as the website/tab you want to keep in the background forcefully. Using about:processes will help you verify if both the β€œaudiocheck.net” (or whatever site you might use to test this) website and the websites of your tabs are β€œSubframes” under one β€œShared Web Process”. You might have to fiddle around with opening and closing tabs until you can get them both on the same process. I'd assume this would be harder to achieve or maybe impossible if you have Fission enabled on Android.

I don't know how much or if this might affect battery life, though if I had to guess it's probably not going to improve it. If someone more knowledgeable can think of a faster or easier way of replicating this workaround, feel free to let everyone know.

Since this buggy behavior of Firefox for Android effectively prevents me from paying online with credit card:

  1. Fill in a credit card info and submit the payment within Firefox.
  2. My bank's authorization app requires me to switch to it, so I can confirm the payment (3D Secure), so I do it.
  3. Then I return to Firefox... and the whole page is refreshed; the payment progress is discarded.
  4. Loss - I cannot pay online while using Firefox.

... I'd like to dispute the specified S3 severity of this bug. Aggressive tab reloading leading to losing an online payment transaction seems like a "severely impaired product with no satisfactory workaround" (unless you count switching to Chrome as satisfactory workaround), so according to https://wiki.mozilla.org/BMO/UserGuide/BugFields#bug_severity that would be at least S2 severity.

IMHO someone needs to give this thing a much bigger priority. It's a problem I encounter every single day several times and I'm sure I'm not the only one, yet it remains unresolved for almost 2 years now. (And as far as I can see it's not even in any way apparent if its being actively worked on.)

Duplicate of this bug: 1872527
See Also: → 1875905
Depends on: 1874181
No longer depends on: 1812691
See Also: → 1725255
See Also: → 1880755
Duplicate of this bug: 1880755
No longer duplicate of this bug: 1880755
See Also: → 1884105
See Also: → 1884106
Depends on: 1813880
See Also: 1813880
Depends on: 1849343
See Also: → 1849343
Blocks: 1824118
See Also: → 1834253
Duplicate of this bug: 1896087
Depends on: 1725480

One funky quirk of this bug: sometimes when you switch to another tab, and then switch back after a while, things are fine. But if you switch back too quickly (or immediately), that causes the tab to reload.

Duplicate of this bug: 1909398
Whiteboard: [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation] → [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation][geckoview:2024H2?]
Whiteboard: [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation][geckoview:2024H2?] → [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation]
Depends on: 1912218
Depends on: 1912732
See Also: → 1912793
Blocks: 1837010
See Also: → 1892395
Depends on: 1905087
See Also: → 1939246
Whiteboard: [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation] → [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation][android-tab-reloading]

I'm also experienced this with firefox android, even happening on every fork of it. Really wanted to use firefox mobile as my main browser but with this bug still happening its almost impossible to fill totp 2fa code when totp 2fa form page always reload. Ironically it even happened on the login page for mozilla account ie the page to login to the browser itself.

Jeff, please change "Fenix" to "Firefox for Android" in the title of this issue. Most users have no clue that the codename of the app is/was Fenix, and the "Fenix" product has already been renamed to "Firefox for Android" on Bugzilla.

Flags: needinfo?(jboek)
Blocks: 1958606

Is there an inkling of an indication that this years old bug is being worked on?

I love Firefox very much, but the constant reloading often makes this otherwise fantastic browser unusable in ordinary browsing tasks.

Hello Roger,
Our team is currently working on optimizing the foreground/background memory&CPU utilization of our app's processes. It is being worked under the child tickets that are linked to this one. Optimizing our app processes' resource usage will help our content processes live longer (to not get killed by the Android OS due to high consumption), and(/or) host more tabs w/out reloading.
While this ticket does not have any active patch attached, several child issues linked to this meta/parent ticket are actively being worked on currently.

Depends on: 1960243
Duplicate of this bug: 1962307
Flags: needinfo?(jboek)
Summary: [meta] Tabs reload too often in Fenix → [meta] Tabs reload too often in Firefox for Android
Duplicate of this bug: 1975057
Depends on: 1983693

Open a private tab to keep the notification open seem mitigate this issue a bit. Tabs rarely got closed. But the tab resume process is a bit slow.

Duplicate of this bug: 2001784

Is there anything new? I'm jumping from bug to bug, from duplicate to duplicate, till I am back here.
It's pretty annoying, especially on websites which need inputs from other apps (i.e. authentication, bank accounts, ...) sending an auth code to another app (email, SMS, ...)
Switching to another app and back to FF makes the tab reload losing the webpage where the field to enter the code was available.
I could overcome it by splitting the screen in two with FF in one half and the second app in the other display half, but it's not always possible, due to screen size limitations.

Ok, there's a workaround, just found it, it seems to work, at least sometimes:
Three dots->settings->xustomize->disable pull to reload

Side effects: you cannot pull to reload a page now.

Somehow switching tabs or apps triggers the pull to refresh action. Why?

Is that totally consistent in your testing? I'm not sure where to find the relevant code to snoop around, but that seems like a very good lead.

See Also: → 2000146

On my Android 12 device if I edit the Background Process Limit setting under Developer Options and set it to Standard Limit the issue does not appear at this time anymore.

(In reply to leodp@yahoo.com from comment #40)

Ok, there's a workaround, just found it, it seems to work, at least sometimes:
Three dots->settings->xustomize->disable pull to reload
...
Somehow switching tabs or apps triggers the pull to refresh action. Why?

Tried this and it did not work.

Also, it really seems like this bug affects some sites much more than others. Have devs investigated whether JavaScript plays a role, such as code that detects when a page is focused or not, AJAX and other async processes, or anything else that might "time out" when not focused?

Is dom.suspend_inactive.enabled = true in about:config causing this bug? Could you guys try this?

(In reply to Tom25519 from comment #48)

Is dom.suspend_inactive.enabled = true in about:config causing this bug? Could you guys try this?

For Android, about:config works for beta or Nightly builds only

(In reply to pierce21 from comment #42)

On my Android 12 device if I edit the Background Process Limit setting under Developer Options and set it to Standard Limit the issue does not appear at this time anymore.

The above solved it for me thus I have to assume this apparent bug is rather Android's memory management itself controlling the apps behavior.

(In reply to pierce21 from comment #50)

(In reply to pierce21 from comment #42)

On my Android 12 device if I edit the Background Process Limit setting under Developer Options and set it to Standard Limit the issue does not appear at this time anymore.

The above solved it for me thus I have to assume this apparent bug is rather Android's memory management itself controlling the apps behavior.

How can i activate the Developer Mode and where to find the Background process under Android/Firefox?

(In reply to Tom25519 from comment #48)

Is dom.suspend_inactive.enabled = true in about:config causing this bug? Could you guys try this?

I have disabled this config on Nightly, but it does not solve the problem.

(In reply to pierce21 from comment #50)

(In reply to pierce21 from comment #42)

On my Android 12 device if I edit the Background Process Limit setting under Developer Options and set it to Standard Limit the issue does not appear at this time anymore.

I have set this to Standard limit, but it does not solve the problem. (I wouldn't be surprised if setting a lower limit makes the problem worse, but it is not the source cause.)

...unless, I don't imagine there's a way to completely exempt Firefox from Android's background process cleanup, is there? (I've already set Firefox's battery optimization to Unrestricted as well)

(In reply to Elijah from comment #52)

(In reply to Tom25519 from comment #48)

Is dom.suspend_inactive.enabled = true in about:config causing this bug? Could you guys try this?

I have disabled this config on Nightly, but it does not solve the problem.

(In reply to pierce21 from comment #50)

(In reply to pierce21 from comment #42)

On my Android 12 device if I edit the Background Process Limit setting under Developer Options and set it to Standard Limit the issue does not appear at this time anymore.

I have set this to Standard limit, but it does not solve the problem. (I wouldn't be surprised if setting a lower limit makes the problem worse, but it is not the source cause.)

...unless, I don't imagine there's a way to completely exempt Firefox from Android's background process cleanup, is there? (I've already set Firefox's battery optimization to Unrestricted as well)

Depends on your phone. What model of device and version of Android are you running?

(In reply to pierce21 from comment #53)

(In reply to Elijah from comment #52)
Depends on your phone. What model of device and version of Android are you running?

Google Pixel 8 Pro, Android 16

What exactly do you suggest depends on my phone?

(I am not lacking in RAM or CPU, if that's what you're wondering. I don't have much running on my phone, so I never encounter any resource throttling.)

(In reply to Elijah from comment #54)

(In reply to pierce21 from comment #53)

(In reply to Elijah from comment #52)
Depends on your phone. What model of device and version of Android are you running?

Google Pixel 8 Pro, Android 16

What exactly do you suggest depends on my phone?

(I am not lacking in RAM or CPU, if that's what you're wondering. I don't have much running on my phone, so I never encounter any resource throttling.)

As someone that has a P8P and has never had such problems with reloading pages. Can I ask you to share what extensions you're running? Also whether or not you're running a virus checker or memory management app of any sort?

(In reply to Elijah from comment #54)

(In reply to pierce21 from comment #53)

(In reply to Elijah from comment #52)
Depends on your phone. What model of device and version of Android are you running?

Google Pixel 8 Pro, Android 16

What exactly do you suggest depends on my phone?

(I am not lacking in RAM or CPU, if that's what you're wondering. I don't have much running on my phone, so I never encounter any resource throttling.)

For anyone visiting - try here for instructions to stop having FF killed https://dontkillmyapp.com/

There is some kind of regression regarding this issue in the last version.

I'm using Firefox in my Pixel 4a for years without any issue like this, but since last version this issue introduced in my device also.

(In reply to sha-265 from comment #57)

There is some kind of regression regarding this issue in the last version.

I'm using Firefox in my Pixel 4a for years without any issue like this, but since last version this issue introduced in my device also.

A quick search shows that since the battery mandatory throttling, some users are reporting issues with memory management. Though this is exoected to be down to the age of the device and the quality of memory used. The same search results recommend trading the phone for something else with the help of the compensation plan that Google rolled out.

(In reply to Paul [pwd] from comment #58)

(In reply to sha-265 from comment #57)

There is some kind of regression regarding this issue in the last version.

I'm using Firefox in my Pixel 4a for years without any issue like this, but since last version this issue introduced in my device also.

A quick search shows that since the battery mandatory throttling, some users are reporting issues with memory management. Though this is exoected to be down to the age of the device and the quality of memory used. The same search results recommend trading the phone for something else with the help of the compensation plan that Google rolled out.

The throttling was long before this issue started in my case. Also my device wasn't eligible for this compensation (that anyway ended earlier this month).

(In reply to sha-265 from comment #57)

There is some kind of regression regarding this issue in the last version.

I'm using Firefox in my Pixel 4a for years without any issue like this, but since last version this issue introduced in my device also.

I have also seen a regression: intempestive reloading while in reader mode after ~ 1s, leading to leaving this mode.
This could also be spontaneous back-in-history (seen with version 147.0.1).

See Also: → 2011037

Same problem on Poco F5 android 13

Depends on: 2000146
Depends on: 1968595

I just wanted to drop in to say the refresh issue is so bad these days, I really want to use Firefox over chrome but the amount of random annoying refreshes are out of control happening many times per day.

It's been an issue for a long time but it's very frustrating, Im currently on this version

149.0 (Build #2016150063), b20f603334b8677ba67ed2fb12a1043b3c8c6933
GV: 149.0-20260318190823
AS: 149.0
OS: Android 15
Plugins: unlock origin
On Motorola G55 5G phone.

The main thing that drives me crazy is when I am writing something or filling in a form, and I go to another tab or app for a few seconds to check something and come back and page refreshes loosing all of the writing! Or pages just refresh while you are still on them for no reason?
This phone has 4GB ram and I often only have Firefox and/or one other thing open and I have closed all tabs but nothing helps and I really don't think the phone would be running out of ram.

(In reply to Rhys from comment #66)

I just wanted to drop in to say the refresh issue is so bad these days, I really want to use Firefox over chrome but the amount of random annoying refreshes are out of control happening many times per day.

It's been an issue for a long time but it's very frustrating, Im currently on this version

149.0 (Build #2016150063), b20f603334b8677ba67ed2fb12a1043b3c8c6933
GV: 149.0-20260318190823
AS: 149.0
OS: Android 15
Plugins: unlock origin
On Motorola G55 5G phone.

The main thing that drives me crazy is when I am writing something or filling in a form, and I go to another tab or app for a few seconds to check something and come back and page refreshes loosing all of the writing! Or pages just refresh while you are still on them for no reason?
This phone has 4GB ram and I often only have Firefox and/or one other thing open and I have closed all tabs but nothing helps and I really don't think the phone would be running out of ram.

The minimum requirement for naked Android 15 is 4GB or RAM.

(In reply to leodp@yahoo.com from comment #40)

Ok, there's a workaround, just found it, it seems to work, at least sometimes:
Three dots->settings->xustomize->disable pull to reload

Side effects: you cannot pull to reload a page now.

Somehow switching tabs or apps triggers the pull to refresh action. Why?

No, doesn't really work.

(In reply to fish4FF from comment #68)

(In reply to Rhys from comment #66)

I just wanted to drop in to say the refresh issue is so bad these days, I really want to use Firefox over chrome but the amount of random annoying refreshes are out of control happening many times per day.

It's been an issue for a long time but it's very frustrating, [...]

Confirmation to Rhys! I changed my FF-rating to one star and stopped recommending FF because of this issue. In my opinion FF-development priorities seem to miss this ancient (2022-01-28) major bug. Very often a webpage is reloaded when switching between Apps (e.g. to copy/paste some data for a form), even on a Xiaomi 13T Pro with 16GB RAM. Also new webpages like wikipedia.org very regularly take 10-15 seconds to load. Other browsers just don't have this major kind of issues.

Maybe the bug is related to some specific phones? I have it in my Xiaomi Redmi Note 13 (sapphiren).
There is a site, which is outdated, since then new OS versions for Xiaomi phones came out, the HyperOS, so things may not fully apply, but it was indicating that the installed OS was tweaking in a non-standard way with the power/resources saving settings and could break apps:
https://dontkillmyapp.com/xiaomi
Can it be that we are seeing something of that sort?

​I completely hear the frustration in this thread. Losing a form you're filling out or dropping a 3D Secure payment transaction because of a sudden tab reload is deeply aggravating. However, treating this as a single, easily patched "Firefox bug" ignores the reality of how Android handles memory. There are three entirely separate issues happening here, and they require different expectations.

1. Hardware Constraints and System Privileges

Many reports here involve devices running at the absolute edge of their hardware limits, resulting in Android stepping in to purge apps.

  • Some users are running modern operating systems, like Android 15, on devices with only 4GB of RAM.
  • The bare minimum RAM requirement for naked Android 15 is 4GB.
  • Running extensions like uBlock Origin further increases Firefox's memory footprint.

When memory runs low, Android's low memory killer daemon (lmkd) forces apps to release RAM. Users often compare Firefox to Chrome and note that Chromium doesn't reload as often. They are halfway right. Chromium-based browsers have deep, native integration and privileges on Android that Firefox simply does not. When system resources are tight, Android will inherently give its native engine more leeway while ruthlessly purging third-party engines like Gecko. The harsh reality is that on lower-end devices, the OS will always target Firefox first. If you want heavy-duty multitasking, purchasing an older flagship device is almost always a better investment than buying a newer low-end or mid-range phone.

2. Aggressive OEM Memory Management

There is a massive difference between standard Android memory management and the aggressive task-killing built into certain device brands, particularly Xiaomi.

  • Users on devices like the Xiaomi Redmi Note 13 and Xiaomi 13T Pro are experiencing reloads even with ample RAM.
  • ​These OS variants use non-standard resource-saving tweaks that actively break background apps to artificially preserve battery.

While resources like dontkillmyapp.com can sometimes mitigate this, it is an uphill battle. The trade-off for purchasing an imported device with impressive specs at a low price point is dealing with an OS that does not behave standardly. This is an OEM choice, not a Mozilla failure.

3. Firefox's Architectural Realities

Finally, Mozilla does bear responsibility for architectural designs that currently make Fenix more vulnerable to background kills, though these are complex engineering hurdles, not simple bugs.

  • Unlike Chromium, which uses one process per tab, current Firefox builds often rely on a main process and just two content processes.
  • If Android's lmkd gets aggressive and kills a shared tab process or the add-ons process, multiple tabs, including the foreground tab, are forced to reload.

However, this is actively being worked on. Developers are optimizing background memory and CPU utilization. More importantly, the ongoing shift toward Isolated Processes (Fission), which provides one process per tab, makes Firefox behave much more granularly like Chromium. This ensures that when Android inevitably claims background memory, it won't take your active tab down with it.

All of this has been stated before and is general knowledge. But it helps to collate it and present it coherently once in a while.

Guys I managed to implement a workaround, that fixes it by let's say 90%. All I did was turn on autostart for Firefox and it mostly stopped. This isn't a fix though but for some it can be useful.

(In reply to Ilias Kslr from comment #72)

Guys I managed to implement a workaround, that fixes it by let's say 90%. All I did was turn on autostart for Firefox and it mostly stopped. This isn't a fix though but for some it can be useful.

Where is this autostart, where to find it and how to turn it on?

(In reply to oldanyper from comment #73)

(In reply to Ilias Kslr from comment #72)

Guys I managed to implement a workaround, that fixes it by let's say 90%. All I did was turn on autostart for Firefox and it mostly stopped. This isn't a fix though but for some it can be useful.

Where is this autostart, where to find it and how to turn it on?

Setup->Apps

(In reply to leodp@yahoo.com from comment #74)

(In reply to oldanyper from comment #73)

(In reply to Ilias Kslr from comment #72)

Guys I managed to implement a workaround, that fixes it by let's say 90%. All I did was turn on autostart for Firefox and it mostly stopped. This isn't a fix though but for some it can be useful.

Where is this autostart, where to find it and how to turn it on?

Setup->Apps

Then what, cause I don't see any autostart

(In reply to oldanyper from comment #73)

(In reply to Ilias Kslr from comment #72)

Guys I managed to implement a workaround, that fixes it by let's say 90%. All I did was turn on autostart for Firefox and it mostly stopped. This isn't a fix though but for some it can be useful.

Where is this autostart, where to find it and how to turn it on?

On my phone I had to go to Settings>Apps, from there you should find a button or a drop down menu saying "background autostart".

(In reply to Ilias Kslr from comment #76)

(In reply to oldanyper from comment #73)

(In reply to Ilias Kslr from comment #72)

Guys I managed to implement a workaround, that fixes it by let's say 90%. All I did was turn on autostart for Firefox and it mostly stopped. This isn't a fix though but for some it can be useful.

Where is this autostart, where to find it and how to turn it on?

On my phone I had to go to Settings>Apps, from there you should find a button or a drop down menu saying "background autostart".

I don't see any button that says autostart

You need to log in before you can comment on or make changes to this bug.