If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

navigator.geolocation.watchPosition causes extreme CPU utilization

RESOLVED WORKSFORME

Status

()

Core
Geolocation
RESOLVED WORKSFORME
7 years ago
7 years ago

People

(Reporter: rbarnes, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

7 years ago
User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.7) Gecko/20100713 Firefox/3.6.7

Whenever a page invokes the Geolocation API call navigator.geolocation.watchPosition, Firefox CPU utilization goes above 100%.    Since this is on a Mac OS machine, I expect that the source is somewhere in NetworkGeolocationProvider or "@mozilla.org/wifi/monitor" (maybe due to too-frequent polling of WiFi data?), but I haven't tracked it down precisely.  As soon as the page in question is closed (and shutdown() is called on NetworkGeolocationProvider), CPU usage goes back to normal.

Reproducible: Always

Steps to Reproduce:
1. Open a page that calls navigator.geolocation.watchPosition()
2. Wait a few seconds
3. Close the page 

- or -

1. Open any page
2. Open a Firebug console
3. Make a call to navigator.geolocation.watchPosition()
4. Wait a few seconds
5. Close the page 
Actual Results:  
Firefox CPU utilization ramps up to >100% after watchPosition() call, then falls back to normal shortly after page is closed.

Expected Results:  
CPU usage should remain roughly constant.
Component: General → Geolocation
Product: Firefox → Core
QA Contact: general → geolocation

Comment 1

7 years ago
Hey Richard,

Can you try this page:

http://people.mozilla.org/~dougt/demos/wifi_access_point_test.html

This will just report what wifi ap's are in the area.

You will have to enable UniversalXPConnect (something not very save to run w/ so use it only to test this.  you may also want to review the code above.)
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Reporter)

Comment 2

7 years ago
Seems to work correctly for me in 4.0b4, and CPU utilization remains reasonable (<=30%)  Also confirmed that CPU utilization remains low for watchPosition() usage at this URI:
<http://geopriv.dreamhosters.com/geo.html>
Similar results with a fresh copy of Firefox 3.6.8.  In other words, cannot replicate with current versions.  Might be that something in 3.6.8 fixed it, or it was a spurious effect.

Sample output from your script follows (X == [0-9a-e])

-----BEGIN-----
XX-XX-XX-XX-XX-XX AS82 -XX

XX-XX-XX-XX-XX-XX Atelier19123 -XX

XX-XX-XX-XX-XX-XX Belkin_G+MIMO_Wireless_151761 -XX

XX-XX-XX-XX-XX-XX BrianandDee -XX

XX-XX-XX-XX-XX-XX gie -XX

XX-XX-XX-XX-XX-XX Green Bull Apartment -XX

XX-XX-XX-XX-XX-XX linksys -XX

XX-XX-XX-XX-XX-XX NoVA417 -XX

XX-XX-XX-XX-XX-XX pokerplaya -XX

XX-XX-XX-XX-XX-XX ronodor -XX

XX-XX-XX-XX-XX-XX SANDPAIL -XX

XX-XX-XX-XX-XX-XX sans-fils -XX

XX-XX-XX-XX-XX-XX yetanother -XX

1
-----END-----

Comment 3

7 years ago
if you see it again, please reopen.
Status: NEW → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.