New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 644501 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

chrome.networkingPrivate.onNetworksChanged fires every 20 seconds

Project Member Reported by mfo...@chromium.org, Sep 6 2016

Issue description

Version: 53.0.2785.87 (Official Build) beta (64-bit) 
OS: Chrome 8530.77.0 (Official Build) beta-channel samus

Repro steps:
0. Connect Pixel to WiFi network (in this case a home access point)
1. Add an event listener to chrome.networkingPrivate.onNetworksChanged
2. Note that listener fires every 20 seconds

JS Console with timestamps:

chrome.networkingPrivate.onNetworksChanged.addListener(e => { console.log(e); })
undefined

[ 39.967s] VM2135:1 ["917ca863-8ec2-45c8-85a8-0a8c34a674e0"]
[ 59.974s] VM2135:1 ["917ca863-8ec2-45c8-85a8-0a8c34a674e0"]
[ 79.968s] VM2135:1 ["917ca863-8ec2-45c8-85a8-0a8c34a674e0"]
[ 99.970s] VM2135:1 ["917ca863-8ec2-45c8-85a8-0a8c34a674e0"]


 
Summary: chrome.networkingPrivate.onNetworksChanged fires every 20 seconds (was: chrome.networkingPrivate.onNetworksChanged)
Labels: -Pri-3 M-55 Pri-2
Status: Assigned (was: Untriaged)
Could you provide the JS used for in your test app? Thanks!

I just checked the device log (chrome://device-log) and do not see frequent NOTIFY:NetworkListChanged events, which is what should be triggering the networkingPrivate events.

mfoltz@ - could you check chrome://device-log and see if the pattern of NOTIFY:NetworkListChanged events matches what you are seeing in the console?

Also, could you confirm that this is happening steadily, not just for a few minutes after a wake-up or scan request? i.e. once we start scanning, there might be a handful of updates before we stop scanning.

Components: -Internals>Network Internals>Network>Connectivity
> Could you provide the JS used for in your test app? Thanks!

chrome.networkingPrivate.onNetworksChanged.addListener(e => { console.log(e); })

> mfoltz@ - could you check chrome://device-log

Shared a private Drive link with your @google.com account while it was happening

> Also, could you confirm that this is happening steadily,

Yes it's happening steadily
Could it be related to MAC address randomization? In device-log I see Device.SetProperty MACAddressRandomization called repeatedly.

I also see a lot of entries for "scanning = true" even when there's no network UI visible.

Cc: ejcaruso@chromium.org
Yes, it could be. We should not be calling that repeatedly.
+ejcaruso@

Looking at the logs it does not appear that we are setting MACAddressRandomization frequently enough to generate an update every 30 seconds. I will investigate this further this week.

mfoltz@ - If you have a chance could you file a feedback report while this is happening and link it here? That will provide the complete logs (including the device log) and allow Google devs to access the logs.

Comment 8 by mfo...@chromium.org, Sep 12 2016

How do I get a link to the report?  Don't they go to an internal tool that's access controlled?
Ah, yes, it is. If you don't have access then just file the report and include the email address used or include "attn:stevenjb" in the report and I can find and link it here. Thanks!

Okay, submitted feedback under account mfoltz@google.com with attn:stevenjb in the comments.

We've found this issue affects two other network APIs used by the Media Router:
chrome.dial
chrome.mdns

Disabling these APIs in the Media Router will effectively make it unusable for ChromeOS.  We are going to work on some short term fixes for M53.

Could you elaborate on what you mean by "affects"?
Blocking: 647004
Blocking: 646995
Cc: imch...@chromium.org
Labels: -Pri-2 Pri-1
mfoltz@ - As we discussed in email, you should be using onNetworkListChanged, not onNetworksChanged:

chrome.networkingPrivate.onNetworkListChanged.addListener(e => { console.log(e); })

onNetworksChanged will fire every time the signal strength of a connected wifi network changes (gated at some reasonable frequency, apparently 20 seconds).

onNetworkListChanged will change any time the connection state of any network changes, or after a scan (which should only occur when a user opens any networking UI or periodically if there is no connected network).

I tested this in 54 and 55 and I do not see any unexpected calls to onNetworkListChanged. It will get called more than once after a scan request but that is expected.

Looking at your feedback logs, I see a bunch of NetworkListChanged events at 22:42 which I would expect at startup, then one at 22:45, and that is all.

Again, chrome.networkingPrivate.onNetworksChanged firing every 20 seconds is expected behavior so I will close this unless you are actually seeing onNetworkListChanged firing unexpectedly, in which case please change the description and update the JS call you are testing with.

Thanks!

Thanks.

- zivh@ who is CCed owns the production code that calls chrome.networkingPrivate and can provide feedback on whether onNetworkListChanged meets his use-case.

- onNetworksChanged should be documented to not be called from event pages if is invoked every 20 seconds.

- Having an API that can fire events every 20 seconds to a background page is not very battery friendly in general.  Is there any use case for consuming WiFi signal strength in an extension?

- We are seeing the 20-second scanning done by onNetworksChanged also invoking the NetworkChangeNotifier, which affects other chrome.* APIs.  This must be fixed; this work is being tracked in the linked bugs.

After further investigation we do not initiate a scan when a device is idle even if there is no connection exist. i.e. onNetworkListChanged should only get fired when the connection state of a network changes or when a user initiates a scan.

This is a private API. Users are expected to know what they are doing :)

Yes there is a use case, we use this in the Settings page where we want to show the user the current state of all networks.

When I have a chance I will try to improve the documentation.

If NetworkChangeNotifier is causing other events to fire every 20 seconds that is definitely a bug, please go ahead a cc me on those issues. It would be helpful to know if that is Chrome OS specific.

Note: This bug is a symptom, it is not the cause of the issues marked as blocking issues, although those may have a similar root cause.


Status: WontFix (was: Assigned)
Resolving WonFix since networkingPrivateonNetworksChanged is working as intended.

Blocking: -646995
Blocking: -647004
Blocking: 647004
Could you please explain why you re-added "Blocking" with no comment, especially when this issue was closed?

Blocking: -647004
I added a comment in issue 647004. Further discussion should continue there.

Sign in to add a comment