Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Issue 2572803002: [ServiceManager] Eliminate parent-child relationship between services (Closed)

Created:
4 years ago by blundell
Modified:
4 years ago
CC:
chromium-reviews
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[ServiceManager] Eliminate parent-child relationship between services This change eliminates the property that non-singleton services are owned by the first service that connects to them. Instead, singleton and non-singleton services are treated identically by the Service Manager: they go away either (1) when the service requests so or (2) when the Service Manager itself goes away. The motivation for this change is that (a) there are situations where this "tree ownership" model doesn't make sense (see linked bug), and (b) there is nothing currently in the codebase that is utilizing the tree ownership model. If desired, the tree ownership model could be resurrected on a per-service basis by adding a "session manager" attribute to a service's manifest, which would denote that that service should own all of the services that it directly or transitively connects to. This CL also changes Service Manager's destructor to perform two-phase shutdown on its owned Instances. This change eliminates possible deadlock in the following situation: - An Instance A blocks in its destructor for its Runner to complete - That Runner blocks completion on the corresponding Service A shutting down - Service A blocks its shutdown on some distinct Service B shutting down - Service B is waiting to receive a connection error in order to initiate shutdown - ServiceManager never deletes Instance B since it is blocked waiting for the destructor of Instance A to return An example of such a situation is found in connect_test_package.cc: ConnectTestService clears its ProvidedService instances in its OnStop() method, while ProvidedService does not exit its destructor until it receives a connection error. Before this CL, deadlock was not tickled because the ProvidedServices were always killed when the first service that connected to them was killed, which happened to be before ConnectTestService was killed. BUG=672863 Committed: https://crrev.com/7bc63b9913f48759d9ac0004a1198b307209985a Cr-Commit-Position: refs/heads/master@{#438780}

Patch Set 1 #

Patch Set 2 : More general fix for ConnectTest shutdown deadlock #

Unified diffs Side-by-side diffs Delta from patch set Stats (+27 lines, -71 lines) Patch
M services/service_manager/service_manager.h View 1 chunk +3 lines, -4 lines 0 comments Download
M services/service_manager/service_manager.cc View 1 7 chunks +24 lines, -37 lines 0 comments Download
M services/service_manager/tests/lifecycle/lifecycle_unittest.cc View 2 chunks +0 lines, -30 lines 0 comments Download

Messages

Total messages: 24 (19 generated)
blundell
The actual change took very little time, but debugging the ConnectTest hang that resulted took ...
4 years ago (2016-12-14 10:23:41 UTC) #16
Ken Rockot(use gerrit already)
lgtm
4 years ago (2016-12-14 21:35:02 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2572803002/20001
4 years ago (2016-12-15 07:07:08 UTC) #19
commit-bot: I haz the power
Committed patchset #2 (id:20001)
4 years ago (2016-12-15 08:05:13 UTC) #22
commit-bot: I haz the power
4 years ago (2016-12-15 08:07:58 UTC) #24
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/7bc63b9913f48759d9ac0004a1198b307209985a
Cr-Commit-Position: refs/heads/master@{#438780}

Powered by Google App Engine
This is Rietveld 408576698