Closed Bug 2070871 Opened 2 months ago Closed

Repeated geolocation requests pile up network location provider fallbacks while the location portal never delivers a position

Categories

(Toolkit :: Geolocation Provider, defect)

Desktop
Linux
defect

Tracking

()

RESOLVED FIXED
158 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 157+ fixed
firefox-esr153 157+ fixed
firefox156 --- fixed
firefox157 + fixed
firefox158 --- fixed

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:

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.

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.

Assignee: nobody → jstutte
Status: NEW → ASSIGNED
Pushed by jstutte@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/2524531b4fe1 https://hg.mozilla.org/integration/autoland/rev/43a314af5029 Reuse the pending MLS fallback when PortalLocationProvider::Watch is called again. r=geoprovider-reviewers,saschanaz
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 158 Branch
See Also: → 2071182

This affects only Linux, so not ESR 115.

The patch landed in nightly and beta is affected, along with ESR.
:jstutte, is this bug important enough to require an uplift?

For more information, please visit BugBot documentation.

Flags: needinfo?(jstutte)

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
Attachment #9641809 - Flags: approval-mozilla-beta?

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

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
Attachment #9641810 - Flags: approval-mozilla-esr140?

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

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
Attachment #9641811 - Flags: approval-mozilla-esr153?

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

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
Attachment #9641812 - Flags: approval-mozilla-release?

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

Flags: needinfo?(jstutte)
Attachment #9641809 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attachment #9641811 - Flags: approval-mozilla-esr153? → approval-mozilla-esr153+
Attachment #9641810 - Flags: approval-mozilla-esr140? → approval-mozilla-esr140+
Attachment #9641812 - Flags: approval-mozilla-release? → approval-mozilla-release+
QA Whiteboard: [qa-ver-done-c158/b157]
QA Whiteboard: [qa-ver-done-c158/b157] → [qa-triage-done-c158/b157]

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

Attachment #9678336 - Flags: approval-mozilla-esr115?
Attachment #9678336 - Flags: approval-mozilla-esr115? → approval-mozilla-esr115+
Attachment #9678336 - Attachment is obsolete: true
Attachment #9678336 - Flags: approval-mozilla-esr115+ → approval-mozilla-esr115-
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: