MessurementBrokerService
listed.MeasurementBrokerService
that is not part of Fenix.Also when accessing running services from developer settings there is some weird service running(see screenshot above) within fenix when using private browsing and the app also apears to be running in background whereas other browsers don't seem to be running when backgrounded when using their private browsing.
From a quick search this seems related to the private session notification service.
I'm unfamiliar with GPS using so much memory and this could be a bug.
However, I would also expect private browsing mode to use more memory than normal browsing mode because in private browsing nothing is saved to disk but rather kept in memory. Other browsers might continue to write files to disk (and later clear them, hopefully) which could create a discrepancy in memory usage between us and them.
@snorp Do you have familiarity with this behavior?
To me it looks like something like this is more likely because of the very specific process reported https://stackoverflow.com/a/42162217
@jonalmeida are we correctly disabling the firebase analytics? In the docs it looks like we are using the temporary disabling vs the permanent one? - https://firebase.google.com/docs/analytics/configure-data-collection?platform=android#permanently_deactivate_collection
@ekager I'm not sure what the actual differences are between permanent and temporary, but we could try the permanent version to see if it solves this issue.
That said, it's unclear to me why we believe this is related to private browsing in particular.
Haven't dug too far into it but based on the SO post looks like it's related to the interaction with the persistent notification we show in PBM 🤷🏼
I am very eager to test this. I use permanent private browsing, so I could never have found this discrepancy. The high memory usage (and its annoying consequence of booting other apps from memory) has always been quite a bother, so a reduction in memory usage will be easily noticeable.
ಥ_ಥ
This is with just _one_ tab open, but after a long browsing session. Does Fenix not free memory after closing tabs? I have 3 GB RAM. After System and Fenix took up their share, I had 200 MB of RAM left. No wonder all my other apps keep closing...
Nightly 200801 06:06 (Build #22140616)
@opusforlife2 please also post the exact Nightly version and your about:memory
log when you encounter this memory usage, thanks :)
Edit: I see your version now. Please update your Nightly and test again on the current Nightly: One large memory leak was fixed in 200803.
@hwinnemoe Alright.
@Scripterr We've addressed a few memory leaks – are you still able to reproduce this issue?
@mcomella I found a very frequent leak (or better: different leaks) when using the private mode and filed #13785 for it.
Hi @mcomella , I'm still seeing the service measurement broker service running when using private browsing.
The current action item for this bug is to investigate what the MeasurementBrokerService
is; we're addressing the remaining memory leaks in separate issues.
Hello, so I looked into this found that the MeasurementBrokerService
is shared service with apps that use Google Analytics. This service lives in com.google.firebase:firebase-core
which was a required dependency for Firebase Cloud Messaging that we use as the messaging bridge for services like WebPush and Firefox Send Tab. Since we do not use the analytics component it was an unfortunate coupling where the analytics service would start without us requiring it.
It now seems however that the dependency on firebase-core is no longer required for cloud messaging so we can simply remove it and therefore remove it from our dependency tree! This change is the PR that I put up for https://github.com/mozilla-mobile/android-components/issues/8232.
To verify that the service is no longer attached to our app process, I ran adb shell dumpsys activity processes
before and after testing my change in Fenix.
Before my patch, I was able to see the MeasurementBrokerService as part of the connections to the Fenix app:
com.google.android.gms/.measurement.service.MeasurementBrokerService:@35871ee}
- ConnectionRecord{c94f871 u0 CR WPRI
Below are two larger snippets of the system info for reference:
*APP* UID 10719 ProcessRecord{7f01369 14742:org.mozilla.fenix/u0a719}
user #0 uid=10719 gids={50719, 20719, 9997, 3003}
mRequiredAbi=arm64-v8a instructionSet=arm64
class=org.mozilla.fenix.FenixApplication
dir=/data/app/org.mozilla.fenix-ICrwlpgyGkBhcQfCKth2aw==/base.apk publicDir=/data/app/org.mozilla.fenix-ICrwlpgyGkBhcQfCKth2aw==/base.apk data=/data/user/0/org.mozilla.fenix
packageList={org.mozilla.fenix}
compat={440dpi}
thread=android.app.IApplicationThread$Stub$Proxy@a0cfa4f
pid=14742 starting=false
lastActivityTime=-1h4m53s522ms lastPssTime=-28m55s858ms pssStatType=1 nextPssTime=+44m34s867ms
adjSeq=18519600 lruSeq=5015840 lastPss=171MB lastSwapPss=58MB lastCachedPss=171MB lastCachedSwapPss=58MB
procStateMemTracker: best=1 (1=1 11.390625x, 4=1 656.8408x) / pending state=4 highest=1 985.2612x
cached=true empty=true
serviceb=true serviceHighRam=false
oom: max=1001 curRaw=1001 setRaw=930 cur=1001 set=930
lastCompactTime=2366616705 lastCompactAction=2 mCurSchedGroup=0 setSchedGroup=0 systemNoUi=false trimMemoryLevel=0
curProcState=17 mRepProcState=17 pssProcState=17 setProcState=17 lastStateTime=-15m25s133ms
hasShownUi=true pendingUiClean=false hasAboveClient=false treatLikeActivity=false
lastTopTime=-1h4m53s570ms
startSeq=136669
mountMode=DEFAULT
lastCpuTime=0 whenUnimportant=-15m25s144ms
lastRequestedGc=-4h15m33s590ms lastLowMemory=-4h15m33s590ms reportLowMemory=false
Activities:
- ActivityRecord{33a7845 u0 org.mozilla.fenix/.App t33982}
Recent Tasks:
- TaskRecord{395b6a1 #33982 A=org.mozilla.fenix U=0 StackId=4004 sz=1}
Configuration={1.0 310mcc260mnc [en_GB,de_DE] ldltr sw392dp w392dp h782dp 440dpi nrml long port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2280) mAppBounds=Rect(0, 0 - 1080, 2236) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.48869}
OverrideConfiguration={0.0 ?mcc?mnc ?localeList ?layoutDir ?swdp ?wdp ?hdp ?density ?lsize ?long ?ldr ?wideColorGamut ?orien ?uimode ?night ?touch ?keyb/?/? ?nav/? winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=null mWindowingMode=undefined mDisplayWindowingMode=undefined mActivityType=undefined mAlwaysOnTop=undefined mRotation=undefined}}
mLastReportedConfiguration={1.0 310mcc260mnc [en_GB,de_DE] ldltr sw392dp w392dp h782dp 440dpi nrml long port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2280) mAppBounds=Rect(0, 0 - 1080, 2236) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.48869}
Services:
- ServiceRecord{2691834 u0 org.mozilla.fenix/org.mozilla.gecko.gfx.SurfaceAllocatorService}
Connections:
- ConnectionRecord{1ddf60a u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{23cdf48 u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{51730fa u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{654891c u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{7a9e251 u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{8fa003d u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{b723a79 u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{b73368f u0 CR WACT com.google.android.gms/.measurement.service.MeasurementBrokerService:@35871ee}
- ConnectionRecord{c94f871 u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
- ConnectionRecord{dcd0559 u0 CR WPRI org.mozilla.fenix/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@31ee675}
dumpsys after patch
*APP* UID 10798 ProcessRecord{fc99b24 21305:org.mozilla.fenix.debug/u0a798}
user #0 uid=10798 gids={50798, 20798, 9997, 3003}
mRequiredAbi=arm64-v8a instructionSet=arm64
class=org.mozilla.fenix.DebugFenixApplication
dir=/data/app/org.mozilla.fenix.debug-aUexslhqVaCRNwyykHfs9A==/base.apk publicDir=/data/app/org.mozilla.fenix.debug-aUexslhqVaCRNwyykHfs9A==/base.apk data=/data/user/0/org.mozilla.fenix.debug
packageList={org.mozilla.fenix.debug}
compat={440dpi}
thread=android.app.IApplicationThread$Stub$Proxy@a76e71
pid=21305 starting=false
lastActivityTime=-13m59s601ms lastPssTime=-1m32s311ms pssStatType=0 nextPssTime=+6m3s276ms
adjSeq=18556697 lruSeq=5026797 lastPss=234MB lastSwapPss=98KB lastCachedPss=0.00 lastCachedSwapPss=0.00
procStateMemTracker: best=1 (1=1 11.390625x)
cached=false empty=true
oom: max=1001 curRaw=200 setRaw=200 cur=200 set=200
lastCompactTime=0 lastCompactAction=0 mCurSchedGroup=2 setSchedGroup=2 systemNoUi=false trimMemoryLevel=0
curProcState=5 mRepProcState=5 pssProcState=5 setProcState=5 lastStateTime=-13m59s601ms
hasShownUi=true pendingUiClean=true hasAboveClient=false treatLikeActivity=false
mHasForegroundServices=true forcingToImportant=null
reportedInteraction=false fgInteractionTime=-13m41s59ms
lastTopTime=-13m41s59ms
hasStartedServices=true
startSeq=137248
mountMode=DEFAULT
lastRequestedGc=-13m59s610ms lastLowMemory=-13m59s610ms reportLowMemory=false
mDebugging=true mCrashing=false null mNotResponding=false null bad=false
Activities:
- ActivityRecord{d953314 u0 org.mozilla.fenix.debug/.App t34010}
Recent Tasks:
- TaskRecord{46c8f2e #34010 A=org.mozilla.fenix.debug U=0 StackId=4042 sz=1}
Configuration={1.0 310mcc260mnc [en_GB,de_DE] ldltr sw392dp w392dp h782dp 440dpi nrml long port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2280) mAppBounds=Rect(0, 0 - 1080, 2236) mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.48853}
OverrideConfiguration={0.0 ?mcc?mnc ?localeList ?layoutDir ?swdp ?wdp ?hdp ?density ?lsize ?long ?ldr ?wideColorGamut ?orien ?uimode ?night ?touch ?keyb/?/? ?nav/? winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=null mWindowingMode=undefined mDisplayWindowingMode=undefined mActivityType=undefined mAlwaysOnTop=undefined mRotation=undefined}}
mLastReportedConfiguration={0.0 ?mcc?mnc ?localeList ?layoutDir ?swdp ?wdp ?hdp ?density ?lsize ?long ?ldr ?wideColorGamut ?orien ?uimode ?night ?touch ?keyb/?/? ?nav/? winConfig={ mBounds=Rect(0, 0 - 0, 0) mAppBounds=null mWindowingMode=undefined mDisplayWindowingMode=undefined mActivityType=undefined mAlwaysOnTop=undefined mRotation=undefined}}
Services:
- ServiceRecord{7e4d060 u0 org.mozilla.fenix.debug/org.mozilla.fenix.session.PrivateNotificationService}
Connections:
- ConnectionRecord{1974590 u0 CR WPRI org.mozilla.fenix.debug/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@f114853}
- ConnectionRecord{a204423 u0 CR WPRI org.mozilla.fenix.debug/org.mozilla.gecko.process.GeckoChildProcessServices$tab0:@f114853}
I also verified that Send Tab and WebPush still work as expected with this change, but it would be great to have QA verify it as well.
A screenshot of the debug build showing there is no more service (because screenshots are cool):
This should be available in the latest nightly now. For QA verification I've updated the STR to correctly represent what this work entailed:
MessurementBrokerService
listed.MeasurementBrokerService
that is not part of Fenix.Hi, verified as fixed on Nightly 8/31 with:
Note:
Most helpful comment
This should be available in the latest nightly now. For QA verification I've updated the STR to correctly represent what this work entailed:
Steps to reproduce
Expected
MessurementBrokerService
listed.Actual
MeasurementBrokerService
that is not part of Fenix.