Repeated geolocation requests pile up network location provider fallbacks while the location portal never delivers a position
Categories
(Toolkit :: Geolocation Provider, defect)
Tracking
()
People
(Reporter: jstutte, Assigned: jstutte)
References
(Blocks 2 open bugs)
Details
Attachments
(5 external files, 1 obsolete file)
On Linux with geo.provider.use_portal, a client whose portal session never produces a position accumulates one live NetworkGeolocationProvider per geolocation request for the lifetime of the browser session. Each leaked instance keeps its 5s repeating timer and its nsWifiMonitor listener registration, and all of them issue network requests together whenever the wifi access point list changes.
Mechanism:
GeolocationService::StartDevicecallsmProvider->Startup()andmProvider->Watch(this)for every allowed request;StopDeviceonly runs from the inactivity timer.
https://searchfox.org/firefox-main/rev/8db09b47689dcfc25671b178619b03ad214c6369/toolkit/components/geolocation/GeolocationService.cpp#211-256PortalLocationProvider::Watchassigns a freshMLSFallback(12000)tomMLSProviderunconditionally whenevermLastGeoPositionCoordsis null, dropping the previous fallback without callingShutdown()on it.
https://searchfox.org/firefox-main/rev/8db09b47689dcfc25671b178619b03ad214c6369/dom/system/linux/PortalLocationProvider.cpp#299- The dropped
MLSFallbackstill owns a startedNetworkGeolocationProvider. That instance stays alive through its timer callback and its wifi listener registration, so it keeps callingsendLocationRequestforever. PortalLocationProvider::NotifyErrorguards the same assignment withif (!mMLSProvider);Watchdoes not.
https://searchfox.org/firefox-main/rev/8db09b47689dcfc25671b178619b03ad214c6369/dom/system/linux/PortalLocationProvider.cpp#129GCLocProviderPriv::FallbackToMLShandles the same situation correctly by callingStopMLSFallback()first.
https://searchfox.org/firefox-main/rev/8db09b47689dcfc25671b178619b03ad214c6369/dom/system/linux/GeoclueLocationProvider.cpp#359
Effect on traffic: GeoIP requests from the leaked instances are all served by the shared request cache since bug 2048118, but a wifi access point list change that fails the cache comparison makes every leaked instance issue a real request before the first response refills the cache (there is no in-flight guard, see bug 2064959).
Telemetry (release 154, Linux, 2026-08-17 to 2026-09-06, 10% sample): about ten clients above the 17,280 requests per client-day that a single 5s timer can produce account for 84% of all remaining billable network geolocation requests on 154. Their fingerprint matches this leak and not the GeoClue loop fixed by bug 2048118: geolocation.linux_provider = portal, zero GeoClue starts, 95-100% network_wifi_and_ip, 500-2800 geolocation.fallback[on_timeout] per client-day, and 100-450 million geolocation_cache_hit[NetworkGeolocationProvider] per client over three weeks, i.e. hundreds of timer firings per second.
Proposed fix: in Watch, shut down the existing fallback before replacing it, or reuse it the way MLSFallback::Startup already supports for a running provider. The mRefreshTimer path for mLastGeoPositionCoords is unaffected.
| Assignee | ||
Comment 1•2 months ago
|
||
Watch() runs for every new geolocation request while the provider stays
started. While the portal has not delivered a position yet, each call
replaced the MLSFallback without shutting the previous one down, so its
NetworkGeolocationProvider stayed alive with its repeating timer and wifi
listener for the rest of the session.
Reuse the existing fallback instead, and add a gtest that counts the armed
fallback timers across repeated Watch() calls.
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Updated•2 months ago
|
| Assignee | ||
Comment 5•2 months ago
|
||
This affects only Linux, so not ESR 115.
Comment 6•2 months ago
|
||
The patch landed in nightly and beta is affected, along with ESR.
:jstutte, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta and ESR approvals.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox157and the ESR status flag(s) towontfix.
For more information, please visit BugBot documentation.
Comment 7•2 months ago
|
||
firefox-beta Uplift Approval Request
- User impact if declined/Reason for urgency: Telemetry shows that there are (only on release) a few clients where the piling up is that deep that it's visible in our billing data for GLS. We do not know what the user experience in that case looks like, it may affect performance or not, but it visibly accounts for a non-trivial amount of (useless) billable requests.
We will not know from data if this is solved until it hits release, and the patch is simple enough to not wait further with it.
This affects only Linux (not even Android).
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing: none
- Risk associated with taking this patch: low
- Explanation of risk level: A one line check that avoids the pile up, backed by a test.
- String changes made/needed?: none
- Is Android affected?: no
| Assignee | ||
Comment 8•2 months ago
|
||
Watch() runs for every new geolocation request while the provider stays
started. While the portal has not delivered a position yet, each call
replaced the MLSFallback without shutting the previous one down, so its
NetworkGeolocationProvider stayed alive with its repeating timer and wifi
listener for the rest of the session.
Reuse the existing fallback instead, and add a gtest that counts the armed
fallback timers across repeated Watch() calls.
Original Revision: https://phabricator.services.mozilla.com/D324916
Comment 9•2 months ago
|
||
firefox-esr140 Uplift Approval Request
- User impact if declined/Reason for urgency: Telemetry shows that there are (only on release) a few clients where the piling up is that deep that it's visible in our billing data for GLS. We do not know what the user experience in that case looks like, it may affect performance or not, but it visibly accounts for a non-trivial amount of (useless) billable requests.
We will not know from data if this is solved until it hits release, and the patch is simple enough to not wait further with it.
This affects only Linux (not even Android).
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing: none
- Risk associated with taking this patch: low
- Explanation of risk level: A one line check that avoids the pile up, backed by a test.
- String changes made/needed?: none
- Is Android affected?: no
| Assignee | ||
Comment 10•2 months ago
|
||
Watch() runs for every new geolocation request while the provider stays
started. While the portal has not delivered a position yet, each call
replaced the MLSFallback without shutting the previous one down, so its
NetworkGeolocationProvider stayed alive with its repeating timer and wifi
listener for the rest of the session.
Reuse the existing fallback instead, and add a gtest that counts the armed
fallback timers across repeated Watch() calls.
Original Revision: https://phabricator.services.mozilla.com/D324916
Comment 11•2 months ago
|
||
firefox-esr153 Uplift Approval Request
- User impact if declined/Reason for urgency: Telemetry shows that there are (only on release) a few clients where the piling up is that deep that it's visible in our billing data for GLS. We do not know what the user experience in that case looks like, it may affect performance or not, but it visibly accounts for a non-trivial amount of (useless) billable requests.
We will not know from data if this is solved until it hits release, and the patch is simple enough to not wait further with it.
This affects only Linux (not even Android).
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing: none
- Risk associated with taking this patch: low
- Explanation of risk level: A one line check that avoids the pile up, backed by a test.
- String changes made/needed?: none
- Is Android affected?: no
| Assignee | ||
Comment 12•2 months ago
|
||
Watch() runs for every new geolocation request while the provider stays
started. While the portal has not delivered a position yet, each call
replaced the MLSFallback without shutting the previous one down, so its
NetworkGeolocationProvider stayed alive with its repeating timer and wifi
listener for the rest of the session.
Reuse the existing fallback instead, and add a gtest that counts the armed
fallback timers across repeated Watch() calls.
Original Revision: https://phabricator.services.mozilla.com/D324916
Comment 13•2 months ago
|
||
firefox-release Uplift Approval Request
- User impact if declined/Reason for urgency: Telemetry shows that there are (only on release) a few clients where the piling up is that deep that it's visible in our billing data for GLS. We do not know what the user experience in that case looks like, it may affect performance or not, but it visibly accounts for a non-trivial amount of (useless) billable requests.
We will not know from data if this is solved until it hits release, and the patch is simple enough to not wait further with it.
This affects only Linux (not even Android).
- Code covered by automated testing?: yes
- Fix verified in Nightly?: yes
- Needs manual QE testing?: no
- Steps to reproduce for manual QE testing: none
- Risk associated with taking this patch: low
- Explanation of risk level: A one line check that avoids the pile up, backed by a test.
- String changes made/needed?: none
- Is Android affected?: no
| Assignee | ||
Comment 14•2 months ago
|
||
Watch() runs for every new geolocation request while the provider stays
started. While the portal has not delivered a position yet, each call
replaced the MLSFallback without shutting the previous one down, so its
NetworkGeolocationProvider stayed alive with its repeating timer and wifi
listener for the rest of the session.
Reuse the existing fallback instead, and add a gtest that counts the armed
fallback timers across repeated Watch() calls.
Original Revision: https://phabricator.services.mozilla.com/D324916
| Assignee | ||
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Comment 15•2 months ago
|
||
| uplift | ||
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Updated•2 months ago
|
Comment 16•2 months ago
|
||
| uplift | ||
Comment 17•2 months ago
|
||
| uplift | ||
Updated•2 months ago
|
Updated•2 months ago
|
Comment 18•2 months ago
|
||
| uplift | ||
Updated•1 month ago
|
Updated•1 month ago
|
Comment 19•7 days ago
|
||
Watch() runs for every new geolocation request while the provider stays
started. While the portal has not delivered a position yet, each call
replaced the MLSFallback without shutting the previous one down, so its
NetworkGeolocationProvider stayed alive with its repeating timer and wifi
listener for the rest of the session.
Reuse the existing fallback instead, and add a gtest that counts the armed
fallback timers across repeated Watch() calls.
Original Revision: https://phabricator.services.mozilla.com/D324916
Updated•7 days ago
|
Updated•7 days ago
|
Updated•2 days ago
|
Description
•