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

Issue 631646 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

CreateConfiguration invokes callback before GUID lookup works

Project Member Reported by cernekee@chromium.org, Jul 26 2016

Issue description

See b/29456708

While testing components/arc/net/arc_net_host_impl.cc we ran into the following sequence of events:

1) GetManagedConfigurationHandler()->CreateConfiguration() is invoked.

2) Chrome performs an async RequestUpdate to ask shill for the new service's properties.

3) Success callback is invoked with GUID + service path.

4) GetStateHandler()->GetNetworkStateFromGuid(guid) is invoked, but returns nullptr because the properties are unavailable.  Therefore the caller cannot determine the service path corresponding to the GUID.

5) RequestUpdate finishes and only *now* is the path available via GetNetworkStateFromGuid().


Some possible solutions:

a) GetNetworkStateFromGuid() can return a limited subset of what it knows about the GUID (maybe just the service path).

b) Add a new GetServicePathFromGuid() function that doesn't depend on having the full NetworkState struct.  Or maybe something equivalent already exists?

c) Defer the CreateConfiguration success callback until RequestUpdate completes.

d) CreateConfiguration callers should just cache the most recent mapping (which is what we're doing in the short term to pass CTS).


Your thoughts?

 
Cc: steve...@chromium.org
Labels: OS-Chrome
Owner: cernekee@chromium.org
There is a reason why the CreateConfiguration callback provides both a GUID and service_path; it may very well be invoked before the NetworkState cache has been updated. In general, configuration UI shouldn't be using NetworkState; the NetworkState class exists as a convenient cache for, e.g., showing the list of available networks.

Scanning through arc_net_host_impl.cc, I am guessing that this is the scenario you are running into (it isn't entirely clear to me from the description above, a lot of context is missing):

1. ArcNetHostImpl::CreateNetwork() is called.
2. ArcNetHostImpl::StartConnect() is called before the NetworkState cache is updated by Shill.

Ideally the client code (arc) should wait until the configured network shows up in GetNetworks() before attempting to connect (I think that is option 'c' above?).

Barring that, we could keep a separate GUID -> service_path map in ArcNetHostImpl for configured networks (option 'd').

I would be wary of modifying NetworkState for these purposes. The current design has NetworkState reflecting Shill state, so modifying it separately would be challenging to keep in sync.

(Note: The plan was to modify Shill to use GUID instead of service_path for Connect and other operations, however the Shill team got pulled away to other things before that could happen. An alternative approach would be to modify NetworkConnectionHandler to take GUID instead of service_path and maintain a separate GUID -> service_path map that Network*Handler would use, effectively option 'b' above).

Status: Assigned (was: Untriaged)
For option (c), which observer/callback would you recommend using to figure out whether the new configuration will show up in GetNetworks?  Is OnNetworkChanged the best option?

I guess this means we'll need to maintain a list of "pending configurations" in arc_net_host_impl and query whether each one exists from the observer callback?

See NetworkStateHandlerObserver::NetworkListChanged

Components: -Internals>Network>Connectivity OS>Systems>Network

Sign in to add a comment