Open Bug 1752594 Opened 3 years ago Updated 1 year ago

[meta] Tabs reload too often in Fenix

Categories

(GeckoView :: General, defect, P2)

Unspecified
All

Tracking

(Not tracked)

People

(Reporter: owlish, Assigned: kaya)

References

(Depends on 10 open bugs)

Details

(Keywords: meta, Whiteboard: [geckoview:2022q4] [geckoview:m109] [fxdroid] [foundation])

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
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
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]
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.

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