Network geolocation requests that get an unparseable 200 response are counted as successful, never cached, and retried at the backoff cap
Categories
(Toolkit :: Geolocation Provider, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox158 | --- | fixed |
People
(Reporter: jstutte, Assigned: jstutte)
References
(Blocks 2 open bugs)
Details
Attachments
(1 external file, 1 obsolete file)
NetworkGeolocationProvider.fetchLocation increments geolocation.geolocation_service[network_ip|network_wifi_and_ip] right before the POST and increments geolocation.network_failures only when fetch() throws or the response status is not 2xx. It then returns response.json() unawaited. When the body is not the expected JSON, the parse rejects inside the try block of sendLocationRequest (as does the result.location.lng access when location is missing). That catch path notifies the listener and grows the backoff, but it neither records a failure nor fills gCachedRequest, so the next repeating-timer tick sends another real request. With a watchPosition consumer this loops at the backoff cap (geo.provider.network.backoffMaxMs, 20 s), up to 4,320 requests per day.
Two populations hit this on release:
- Windows 152+ ships neither the GLS key nor a
geo.provider.network.urldefault (bug 2037099). When the network provider is still selected there (geo.provider.ms-windows-location=false,geo.provider.use_mls, orgeo.provider.testing, see bug 2048776),formatURLPrefreturnsabout:blank, the POST gets an empty 200 and the loop starts. In release telemetry for 154/155 these client-days show hundreds to thousands of "successful" requests per day with zero cache hits and zero failures; Google never sees them. - Clients behind a proxy, antivirus web shield or captive portal that answers 200 with an HTML page, on any platform.
Both inflate the successful-request series used as the billable proxy (dashboard 3070 on STMO) and keep the provider hammering an endpoint that cannot answer.
Suggested fix:
- Count JSON parse and shape failures under
network_failures(same label, or a dedicatedbad_responselabel) so they stop reading as successes. - Do not issue a request at all when the formatted URL is
about:blankor empty; report POSITION_UNAVAILABLE instead. That alone ends the Windows loop. - xpcshell test: serve a 200 with an HTML body, assert the failure counter increments, the cache stays empty and no request storm follows (same HttpServer setup as
dom/geolocation/test/unit/test_geolocation_provider_shutdown.js).
Code: https://searchfox.org/firefox-main/rev/572cbc53633d3ed8a0b1390828611752f0317938/dom/system/NetworkGeolocationProvider.sys.mjs (fetchLocation and the catch in sendLocationRequest).
| Assignee | ||
Comment 1•2 months ago
|
||
A 2xx response whose body is not JSON, or is JSON without a location, was
counted as a successful request and never as a failure. Count it under
geolocation.network_failures like a non-2xx status.
When geo.provider.network.url has no value, formatURLPref() returns
about:blank and the provider POSTed to it on every timer tick. Fail the
request without sending anything instead.
Updated•2 months ago
|
Comment 3•1 month ago
|
||
| bugherder | ||
Updated•1 month ago
|
Comment 4•8 days ago
|
||
A 2xx response whose body is not JSON, or is JSON without a location, was
counted as a successful request and never as a failure. Count it under
geolocation.network_failures like a non-2xx status.
When geo.provider.network.url has no value, formatURLPref() returns
about:blank and the provider POSTed to it on every timer tick. Fail the
request without sending anything instead.
Original Revision: https://phabricator.services.mozilla.com/D327369
Updated•8 days ago
|
Updated•7 days ago
|
Updated•3 days ago
|
Description
•