cryptohome: Flaky test ServiceTestNotInitialized.CheckAsyncTestCredentials |
||
Issue descriptionThe 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)
,
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
,
Aug 1
|
||
►
Sign in to add a comment |
||
Comment 1 by emaxx@chromium.org
, Jul 29The 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_|.