|
|
Created:
4 years, 4 months ago by Daniel Erat Modified:
4 years, 3 months ago CC:
chromium-reviews Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptiondbus: Make ObjectManager get objects after service is ready.
Make dbus::ObjectManager automatically fetch managed objects
after the remote service becomes available. Also remove
Bus::GetManagedObjects(), which produces a large amount of
log spam due to some services not yet being ready. (It was
called by chromeos::DBusThreadManager and
bluez::BluezDBusManager at startup.)
BUG=636554
Committed: https://crrev.com/2ef7d0eda3fe8cb8a73c3ce977b8f1768cd32ece
Cr-Commit-Position: refs/heads/master@{#417405}
Patch Set 1 #
Total comments: 1
Patch Set 2 : make ObjectManager defer getting objects until service is available #Patch Set 3 : remove Bus::GetManagedObjects and BluezDBusManager's call to it #
Total comments: 2
Patch Set 4 : make initialization more serial #
Total comments: 3
Patch Set 5 : remove call to WaitForServiceToBeAvailable #
Messages
Total messages: 49 (29 generated)
derat@chromium.org changed reviewers: + hashimoto@chromium.org, satorux@chromium.org, stevenjb@chromium.org
i still need to write tests for this, but i wanted to get your thoughts on this approach. this looks like it's responsible for fourteen long lines of log spam at boot. :-) ObjectManager already calls ObjectProxy::SetNameOwnerChangedCallback() and automatically invokes GetManagedObjects() when a new owner shows up, so another approach might be to just make ObjectManager's c'tor call ObjectProxy::WaitForServiceToBeAvailable() and use that to automatically fetch the objects if the service is initially available. then we could presumably just remove the Bus::GetManagedObjects() call in DBusThreadManager::InitializeClients().
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_...)
https://codereview.chromium.org/2239123002/diff/1/dbus/object_proxy.cc File dbus/object_proxy.cc (right): https://codereview.chromium.org/2239123002/diff/1/dbus/object_proxy.cc#newcod... dbus/object_proxy.cc:212: return !service_name_owner_.empty(); This member should be accessed only on the D-Bus thread.
On 2016/08/11 22:51:56, Daniel Erat (OOO 8-12 to 8-22) wrote: > i still need to write tests for this, but i wanted to get your thoughts on this > approach. this looks like it's responsible for fourteen long lines of log spam > at boot. :-) > > ObjectManager already calls ObjectProxy::SetNameOwnerChangedCallback() and > automatically invokes GetManagedObjects() when a new owner shows up, so another > approach might be to just make ObjectManager's c'tor call > ObjectProxy::WaitForServiceToBeAvailable() and use that to automatically fetch > the objects if the service is initially available. > > then we could presumably just remove the Bus::GetManagedObjects() call in > DBusThreadManager::InitializeClients(). This approach sounds better. Relying on both SetNameOwnerChangedCallback() and Bus::GetManagedObjects() looks fragile to me.
Description was changed from ========== dbus: Make Bus::GetManagedObjects skip unavailable services. Expose a service's current availability via a new ObjectProxy::ServiceIsAvailable() method, and make Bus::GetManagedObjects() use it to only update objects backed by usable proxies. This greatly cuts down on log spam when Chrome OS boots -- chromeos::DBusThreadManager() calls Bus::GetManagedObjects() before many D-Bus services have started. BUG=636554 ========== to ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove chromeos::DBusThreadManager's call to Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. BUG=636554 ==========
thanks for the comment! i've updated the approach (but haven't yet added tests). does this look better to you?
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove chromeos::DBusThreadManager's call to Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. BUG=636554 ========== to ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. (It was called by chromeos::DBusThreadManager and bluez::BluezDBusManager at startup.) BUG=636554 ==========
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Thanks, this looks promising. https://codereview.chromium.org/2239123002/diff/40001/dbus/object_manager.cc File dbus/object_manager.cc (right): https://codereview.chromium.org/2239123002/diff/40001/dbus/object_manager.cc#... dbus/object_manager.cc:215: GetManagedObjects(); How about calling WaitForServiceToBeAvailable() here instead of in the ctor so that we don't need to manage signals_are_connected_ and service_initially_available_? Are SetupMatchRuleAndFilter() and WaitForServiceToBeAvailable() too slow to perform them sequentially?
https://codereview.chromium.org/2239123002/diff/40001/dbus/object_manager.cc File dbus/object_manager.cc (right): https://codereview.chromium.org/2239123002/diff/40001/dbus/object_manager.cc#... dbus/object_manager.cc:215: GetManagedObjects(); On 2016/09/01 03:26:07, hashimoto wrote: > How about calling WaitForServiceToBeAvailable() here instead of in the ctor so > that we don't need to manage signals_are_connected_ and > service_initially_available_? > Are SetupMatchRuleAndFilter() and WaitForServiceToBeAvailable() too slow to > perform them sequentially? thanks, that seems like a good suggestion! and no, i'd expect that the delay wouldn't cause any issues. i'll ping you when i've uploaded a new version.
The CQ bit was checked by derat@chromium.org to run a CQ dry run
https://codereview.chromium.org/2239123002/diff/60001/dbus/object_manager.h File dbus/object_manager.h (left): https://codereview.chromium.org/2239123002/diff/60001/dbus/object_manager.h#o... dbus/object_manager.h:243: void InitializeObjects(); i moved this into OnSetupMatchRuleAndFilterComplete since the flow through these methods is linear.
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Sorry for not noticing this before. With this code, GetManagedObjects() will get called twice by OnServiceInitiallyAvailable and NameOwnerChanged when the service becomes available, and it'll just waste CPU and other resources. But the good news is that SetupMatchRuleAndFilter sets service_name_owner_. So if service_name_owner_ is not empty, that means the service is available and it's OK to call GetManagedObjects in OnSetupMatchRuleAndFilterComplete without using WaitForServiceToBeAvailable. BTW this class is badly written in terms of thread safety (crbug.com/643512). I will fix it after you land this change. https://codereview.chromium.org/2239123002/diff/60001/dbus/object_manager.cc File dbus/object_manager.cc (right): https://codereview.chromium.org/2239123002/diff/60001/dbus/object_manager.cc#... dbus/object_manager.cc:242: weak_ptr_factory_.GetWeakPtr())); You can just do this here: if (!service_name_owner_.empty()) GetManagedObjects(); If service_name_owner_ is empty, GetManagedObjects() will get called by ObjectManager::NameOwnerChanged when the service becomes available.
https://codereview.chromium.org/2239123002/diff/60001/dbus/object_manager.cc File dbus/object_manager.cc (right): https://codereview.chromium.org/2239123002/diff/60001/dbus/object_manager.cc#... dbus/object_manager.cc:242: weak_ptr_factory_.GetWeakPtr())); On 2016/09/02 08:33:06, hashimoto wrote: > You can just do this here: > > if (!service_name_owner_.empty()) > GetManagedObjects(); > > If service_name_owner_ is empty, GetManagedObjects() will get called by > ObjectManager::NameOwnerChanged when the service becomes available. thanks, i hadn't seen the earlier call to GetServiceOwnerAndBlock and didn't realize that this was already available here. i'll update this (probably next week since i'm out today). :-)
thanks again for the suggestions. mind taking another look?
The CQ bit was checked by derat@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
thanks, lgtm
The CQ bit was checked by derat@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
derat@chromium.org changed reviewers: + steel@chromium.org
rahul, please take a look at device/bluetooth/dbus. thanks!
lgtm
The CQ bit was checked by derat@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
The CQ bit was checked by derat@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. (It was called by chromeos::DBusThreadManager and bluez::BluezDBusManager at startup.) BUG=636554 ========== to ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. (It was called by chromeos::DBusThreadManager and bluez::BluezDBusManager at startup.) BUG=636554 ==========
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. (It was called by chromeos::DBusThreadManager and bluez::BluezDBusManager at startup.) BUG=636554 ========== to ========== dbus: Make ObjectManager get objects after service is ready. Make dbus::ObjectManager automatically fetch managed objects after the remote service becomes available. Also remove Bus::GetManagedObjects(), which produces a large amount of log spam due to some services not yet being ready. (It was called by chromeos::DBusThreadManager and bluez::BluezDBusManager at startup.) BUG=636554 Committed: https://crrev.com/2ef7d0eda3fe8cb8a73c3ce977b8f1768cd32ece Cr-Commit-Position: refs/heads/master@{#417405} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/2ef7d0eda3fe8cb8a73c3ce977b8f1768cd32ece Cr-Commit-Position: refs/heads/master@{#417405} |