New issue
Advanced search Search tips

Issue 841393 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

Mojo embedded services on UI thread are not destroyed at shutdown

Project Member Reported by jamescook@chromium.org, May 9 2018

Issue description

I think they are leaked. I was working on ui::ws2::WindowService and trying to figure out when embedded services are torn down so I did this:

1. Add logging to the constructors of identity::IdentityService and chromeos::MultiDeviceSetupService. Add CHECK(false) to their destructors.
2. Build target_os=chromeos.
3. Run chrome --user-data-dir=foo --enable-features=EnableUnifiedMultiDeviceSetup
4. Hit Ctrl-Shift-Q twice to quit.

You'll see the constructors run but not the destructors.

I tried this with FileService and I *do* see it being torn down. However, FileService runs on the IO thread.

Ken, is this a real problem or am I missing something?

 
I've been operating under the impression that since I embed my MultiDeviceSetupService in the browser process, it will be destroyed upon logout/shutdown. Ken, I believe you alerted me of this when I was originally implementing the service. Do I need to add some special handling instead?
James is correct; they're guaranteed to be shut down only if run on the IO thread. See this thread: https://groups.google.com/a/chromium.org/forum/#!topic/services-dev/orJmSM0Bb-E.

Note that in that thread I produced a proposal for this problem, but I never implemented it.
+sky just FYI

If the design decision is that embedded services leak at shutdown, that's fine with me, I just didn't know that and was surprised.

Personally I think that it's incongruous that embedded services are shut down if they're run on the IO thread but not otherwise. It makes more sense from my POV to either (a) just leak all embedded services and be very clear about that, or (b) leak embedded services by default but provide a mechanism for services to specify that they should be shut down (this is similar to the proposal we ended up at on the email thread IIRC). However, I don't have any cycles to make changes here, so these are just like, my opinions, man.

Comment 5 by roc...@chromium.org, May 14 2018

I don't think we want to adopt a policy of leaking by default in the browser process, since it can pretty easily mask real leaks.

As discussed in the thread you linked, the process simply shouldn't shut down until all its embedded services have quit on their own volition. Because we are far from living in that world however, it seems reasonable to allow embedded services to force their quit tasks to block shutdown as you suggested.
Owner: rockot@google.com

Sign in to add a comment