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

Issue 665316 link

Starred by 1 user

Issue metadata

Status: Archived
Owner:
Closed: May 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

ArcSession may receive stale ArcStopInstance callback.

Project Member Reported by hidehiko@chromium.org, Nov 15 2016

Issue description

Version: ToT
OS: ChromeOS

This happens only when ArcAuthService::reenable_arc_ is true without data removal, AFAIK. Also, AFAIK, there should be no use case.

How it would happen:
- ARC container is terminated.
- DBus signal is sent.
- SessionManagerClient calls ArcSession::ArcInstanceStopped(), as a part of ObserverList call.
- ArcSessionImpl::OnStopped()
- ArcBridgeServiceImpl::OnStopped()
  Old ArcSessionImpl instance is deleted here.
- ArcAuthService::OnBridgeStopped()
  In this function, if data removal is not run then OnArcDataRemoved(true) is called.
- ArcAuthService::OnArcDataRemoved(true):
  If reenable_arc_ is true, EnableArc() is called, then in enable case,
- ArcAuthService::EnableArc()
- ArcAuthService::OnOptInPreferenceChanged()
- ArcAuthService::StartArc()
- ArcBridgeServiceImpl::RequestStart()
- ArcBridgeServiceImpl::PrerequisitesChanged()
- new ArcSessionImpl is created.
- In ctor of ArcSessionImpl, the instance is registered to SessionManagerClient.

The above procedure happens on one stack, so after returning from ArcSessionImpl::OnStopped(),
SessionManagerClient tries to call the remaining observers, which contains new ArcSessionImpl instance.

So, new ArcSessionImpl instance's ArcInstanceStopped() is called, then the ARC restarting is stopped here.


* Possible solutions:
There could be various approaches for the fix.
1) Set NOTIFY_EXISTING_ONLY to the SessionManagerClient's observer_list.
  pros: simplest. cons: large side effect.
2) Inject intermediate class between SessionManagerClient and ArcSessionImpl, which support ObserverList with NOTIFY_EXISTING_ONLY.
  pros: less risky. cons: yet another layer is needed.
3) Return some ID to indicate individual ARC container instance (e.g. PID) via DBus, and route the message to the ArcInstanceStopped() properly.
  pros: in future, we may want to do this for multi-container support. cons: DBus API change is needed.
4) (Short time workaround) PostTask() onto the same thread in this case.
  pros: no worry about regression in unrelated place. cons: looks a bit tricky. Not a general solution.
5) Others.

Ryo, Luis, WDYT?

Note: For short-term workaround, I'll use 4).
 
I like the idea of going for 4) right now and then switching to 3).
Uniquely identifying ARC container instances in Chrome should be useful in general so 3) as the long term solution sounds good to me.
PIDs may get recycled so probably IDs generated by base::GenerateGUID() might be a better choice.
Project Member

Comment 3 by bugdroid1@chromium.org, May 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/eac8066060b4518582d5010af801c66b4ff2a89e

commit eac8066060b4518582d5010af801c66b4ff2a89e
Author: Hidehiko Abe <hidehiko@chromium.org>
Date: Fri May 12 05:27:41 2017

login: Add container_instance_id.

Currently at most one ARC container can run.
So, it looks not necessary to identify the container instance.
However, considering racy situation, passing an identifiers
is very useful information to avoid unexpected behavior of the caller.

This CL introduces an identifier and StartArcInstance,
ArcInstanceStopped start to use them.
Note that, currently Chrome simply ignores it.
In later change, racy condition in Chrome will be fixed with
the identifier.

BUG= chromium:665316 
TEST=Ran on device without reading new id in Chrome. It worked.
TEST=Ran on device with reading new hash in Chrome. IDs are properly delivered.
TEST=Ran unittests locally.
TEST=Ran on trybots.

Change-Id: I7f0125e78d10b0405fabb62be0f1672c8df374d7
Reviewed-on: https://chromium-review.googlesource.com/499912
Commit-Ready: Hidehiko Abe <hidehiko@chromium.org>
Tested-by: Hidehiko Abe <hidehiko@chromium.org>
Reviewed-by: Luis Hector Chavez <lhchavez@chromium.org>

[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/mock_dbus_signal_emitter.h
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/dbus_signal_emitter.cc
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/dbus_signal_emitter.h
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/session_manager_impl.cc
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/dbus_bindings/org.chromium.SessionManagerInterface.xml
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/session_manager_impl_unittest.cc
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/session_manager_dbus_adaptor.cc
[modify] https://crrev.com/eac8066060b4518582d5010af801c66b4ff2a89e/login_manager/session_manager_impl.h

Owner: hidehiko@chromium.org
Status: Started (was: Untriaged)
Project Member

Comment 5 by bugdroid1@chromium.org, May 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/02a11f55e9c6ec533b9c811f6f7cc2c255ef4694

commit 02a11f55e9c6ec533b9c811f6f7cc2c255ef4694
Author: hidehiko <hidehiko@chromium.org>
Date: Mon May 22 08:43:06 2017

Read container_instance_id.

In case of race, ArcSession may stop by an event for unrelated
container instance.
To avoid such a situation, this CL reads the container instance id,
which is newly provided by session_manager, and let ArcSession check it.

BUG= 665316 
TEST=Ran on device. Ran trybots.

Review-Url: https://codereview.chromium.org/2887363003
Cr-Commit-Position: refs/heads/master@{#473527}

[modify] https://crrev.com/02a11f55e9c6ec533b9c811f6f7cc2c255ef4694/chrome/browser/chromeos/arc/arc_session_manager.cc
[modify] https://crrev.com/02a11f55e9c6ec533b9c811f6f7cc2c255ef4694/chromeos/dbus/fake_session_manager_client.cc
[modify] https://crrev.com/02a11f55e9c6ec533b9c811f6f7cc2c255ef4694/chromeos/dbus/session_manager_client.cc
[modify] https://crrev.com/02a11f55e9c6ec533b9c811f6f7cc2c255ef4694/chromeos/dbus/session_manager_client.h
[modify] https://crrev.com/02a11f55e9c6ec533b9c811f6f7cc2c255ef4694/components/arc/arc_session.cc

Status: Fixed (was: Started)
Done.

Comment 7 by dchan@chromium.org, Aug 1 2017

Labels: VerifyIn-61

Comment 8 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment