New issue
Advanced search Search tips

Issue 868685 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 1
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

cryptohome: Flaky test ServiceTestNotInitialized.CheckAsyncTestCredentials

Project Member Reported by emaxx@chromium.org, Jul 29

Issue description

The test sometimes fails with the following log:

[WARNING:service_monolithic.cc(80)] Attestation-based enterprise enrollment will not be available.
[INFO:service.cc(238)] Stopping cryptohome task processing.
Error: cryptohome_testrunner: failed with signal SIGSEGV(11)
 
Status: Started (was: Assigned)
The reason is that |service_| outlives |real_crypto| and |real_homedirs|, to which it holds pointers and may use on a background thread ("mount thread").

Specifically, an example of the failing scenario is:
1. The test body finishes, |real_crypto| and |real_homedirs| are destroyed.
   Suppose that the mount thread has *not* yet executed the Service::DoAutoCleanup() task that was posted from Service::Initialize().
2. The test fixture destroying starts - ServiceTestNotInitialized:: ~ServiceTestNotInitialized() is called.
   This results in calling ServiceMonolithic::~ ServiceMonolithic(), which itself chains to Service::StopTasks(), and blocks on base::Thread::Stop().
3. The mount thread starts the Service::DoAutoCleanup() task.
   This callback calls HomeDirs::FreeDiskSpace() on the already-deleted HomeDirs instance, which results in a crash.


One way to fix this issue would be to append to the test body the code that sets the |service_|'s pointers to HomeDirs+Crypto back to still existing |mock_homedirs_| and |mock_crypto_|.
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 31

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

commit 51c8b84fa91630f7c75b9ca906b9604bf76b2251
Author: Maksim Ivanov <emaxx@chromium.org>
Date: Tue Jul 31 01:15:33 2018

cryptohome: Fix flaky CheckAsyncTestCredentials test

Fix the usage-after-destruction of HomeDirs and Crypto
that could sometimes occur.

BUG= chromium:868685 
TEST=existing unit tests

Change-Id: Ibde41da68d87bf56df81a0395b14dbc907ce55db
Reviewed-on: https://chromium-review.googlesource.com/1154224
Commit-Ready: Maksim Ivanov <emaxx@chromium.org>
Tested-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>

[modify] https://crrev.com/51c8b84fa91630f7c75b9ca906b9604bf76b2251/cryptohome/service_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment