chrome.networkingPrivate.onNetworksChanged fires every 20 seconds |
|||||||||||||
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"]
,
Sep 6 2016
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.
,
Sep 7 2016
,
Sep 7 2016
> 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
,
Sep 9 2016
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.
,
Sep 12 2016
Yes, it could be. We should not be calling that repeatedly. +ejcaruso@
,
Sep 12 2016
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.
,
Sep 12 2016
How do I get a link to the report? Don't they go to an internal tool that's access controlled?
,
Sep 12 2016
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!
,
Sep 13 2016
Okay, submitted feedback under account mfoltz@google.com with attn:stevenjb in the comments.
,
Sep 14 2016
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.
,
Sep 14 2016
Could you elaborate on what you mean by "affects"?
,
Sep 14 2016
,
Sep 14 2016
,
Sep 14 2016
,
Sep 15 2016
,
Sep 15 2016
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!
,
Sep 15 2016
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.
,
Sep 15 2016
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.
,
Sep 15 2016
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.
,
Sep 15 2016
Resolving WonFix since networkingPrivateonNetworksChanged is working as intended.
,
Sep 15 2016
,
Sep 15 2016
,
Sep 16 2016
,
Sep 19 2016
Could you please explain why you re-added "Blocking" with no comment, especially when this issue was closed?
,
Sep 19 2016
,
Sep 19 2016
I added a comment in issue 647004. Further discussion should continue there. |
|||||||||||||
►
Sign in to add a comment |
|||||||||||||
Comment 1 by mfo...@chromium.org
, Sep 6 2016