New issue
Advanced search Search tips

Issue 844487 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 6
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Fix MachineLevelUserCloudPolicyEnrollmentTest on Mac

Project Member Reported by zmin@chromium.org, May 18 2018

Issue description

This test will hit CHECK failure on Mac when quit Chrome:
[245:775:0601/160136.055159:FATAL:browser_process_impl.cc(1411)] Check failed: base::RunLoop::IsRunningOnCurrentThread(). 
0   libbase.dylib                       0x000000010cc3a6ec base::debug::StackTrace::StackTrace(unsigned long) + 28
1   libbase.dylib                       0x000000010cb55abf logging::LogMessage::~LogMessage() + 223
2   browser_tests                       0x000000010664594b BrowserProcessImpl::Unpin() + 283
3   browser_tests                       0x0000000105885d24 KeepAliveRegistry::OnKeepAliveStateChanged(bool) + 356
4   browser_tests                       0x0000000105886013 KeepAliveRegistry::Unregister(KeepAliveOrigin, KeepAliveRestartOption) + 211
5   browser_tests                       0x0000000106625e2d -[AppController applicationWillTerminate:] + 141
6   CoreFoundation                      0x00007fff9bd3c54c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
7   CoreFoundation                      0x00007fff9bd3c44b _CFXRegistrationPost + 427
8   CoreFoundation                      0x00007fff9bd3c1b2 ___CFXNotificationPost_block_invoke + 50
9   CoreFoundation                      0x00007fff9bcfa782 -[_CFXNotificationRegistrar find:object:observer:enumerator:] + 2018
10  CoreFoundation                      0x00007fff9bcf976b _CFXNotificationPost + 667
11  Foundation                          0x00007fff9d73b677 -[NSNotificationCenter postNotificationName:object:userInfo:] + 66
12  browser_tests                       0x000000010675937d chrome::HandleAppExitingForPlatform() + 125
13  browser_tests                       0x0000000106625b82 -[AppController tryToTerminateApplication:] + 210
14  browser_tests                       0x00000001067591d2 chrome::AttemptExit() + 210
15  browser_tests                       0x000000010668defa ChromeBrowserMainParts::PreMainMessageLoopRunImpl() + 474
16  browser_tests                       0x000000010668dc1e ChromeBrowserMainParts::PreMainMessageLoopRun() + 62
17  libcontent.dylib                    0x0000000110c2f8b3 content::BrowserMainLoop::PreMainMessageLoopRun() + 67
18  libcontent.dylib                    0x00000001111b45e5 content::StartupTaskRunner::RunAllTasksNow() + 117
19  libcontent.dylib                    0x0000000110c2e042 content::BrowserMainLoop::CreateStartupTasks() + 914
20  libcontent.dylib                    0x0000000110c32575 content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&, std::__1::unique_ptr<content::BrowserProcessSubThread, std::__1::default_delete<content::BrowserProcessSubThread> >) + 101
21  libcontent.dylib                    0x0000000110c2be65 content::BrowserMain(content::MainFunctionParams const&, std::__1::unique_ptr<content::BrowserProcessSubThread, std::__1::default_delete<content::BrowserProcessSubThread> >) + 229
22  libcontent.dylib                    0x0000000111937803 content::RunBrowserProcessMain(content::MainFunctionParams const&, content::ContentMainDelegate*, std::__1::unique_ptr<content::BrowserProcessSubThread, std::__1::default_delete<content::BrowserProcessSubThread> >) + 195
23  libcontent.dylib                    0x000000011193890e content::ContentMainRunnerImpl::Run() + 686
24  libembedder.dylib                   0x0000000115183497 service_manager::Main(service_manager::MainParams const&) + 2855
25  libcontent.dylib                    0x0000000111937714 content::ContentMain(content::ContentMainParams const&) + 68
26  browser_tests                       0x0000000106d61ecc content::BrowserTestBase::SetUp() + 3212
27  browser_tests                       0x00000001065ea5a5 InProcessBrowserTest::SetUp() + 613
28  browser_tests                       0x000000010590231d testing::Test::Run() + 109
29  browser_tests                       0x0000000105903030 testing::TestInfo::Run() + 320
30  browser_tests                       0x0000000105903667 testing::TestCase::Run() + 279
31  browser_tests                       0x000000010590fdf7 testing::internal::UnitTestImpl::RunAllTests() + 871
32  browser_tests                       0x000000010590fa6d testing::UnitTest::Run() + 109
33  browser_tests                       0x0000000106606206 base::TestSuite::Run() + 166
34  browser_tests                       0x00000001065a8985 ChromeTestSuiteRunner::RunTestSuite(int, char**) + 37
35  browser_tests                       0x0000000106d9f3a6 content::LaunchTests(content::TestLauncherDelegate*, unsigned long, int, char**) + 470
36  browser_tests                       0x00000001065a8e9b LaunchChromeTests(unsigned long, content::TestLauncherDelegate*, int, char**) + 347
37  browser_tests                       0x00000001065a88de main + 94
38  libdyld.dylib                       0x00007fffb18f4235 start + 1
39  ???                                 0x0000000000000006 0x0 + 6


The reason is applicationDidFinishLaunching will be called when the PreMessageLoopRun is blocked by WaitUntilCloudPolicyEnrollmentFinished.
The keep_alive_ instance is created during blocking.

Chrome will be quit in case of enrollment failure. However, the keep_alive_ reset triggers the CHECK above as the Chrome hasn't been fully launched yet. 
 

Comment 1 by zmin@chromium.org, Jun 4 2018

Description: Show this description

Comment 2 by zmin@chromium.org, Jun 7 2018

Description: Show this description
Project Member

Comment 3 by bugdroid1@chromium.org, Jul 10

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

commit 0b002e19449048dd96a03aa92b50f96cf27091db
Author: Owen Min <zmin@chromium.org>
Date: Tue Jul 10 15:04:18 2018

Resolve MachineLevelUserCloudPolicyBrowserTests issue on Mac

When the EnterpriseStartupDialog is being displayed to block Chrome launching
process. applicationDidFinishLaunching event is fired and creates the
|keep_alive_| instance.

However, if the launch process is aborted by EnterpriseStartupDialog,
|keep_alive_| deletion causes CHECK failure as Chrome is never ready.

Postpone the applicationDidFinishLaunching event until the dialog is closed to avoid the failure.

Bug:  844487 
Change-Id: I4e4d8b5a265254c8158d4f9657429a8eba318efa
Reviewed-on: https://chromium-review.googlesource.com/1092075
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#573726}
[modify] https://crrev.com/0b002e19449048dd96a03aa92b50f96cf27091db/chrome/browser/app_controller_mac.mm
[modify] https://crrev.com/0b002e19449048dd96a03aa92b50f96cf27091db/chrome/browser/policy/cloud/machine_level_user_cloud_policy_browsertest.cc
[modify] https://crrev.com/0b002e19449048dd96a03aa92b50f96cf27091db/chrome/browser/policy/machine_level_user_cloud_policy_controller.cc
[modify] https://crrev.com/0b002e19449048dd96a03aa92b50f96cf27091db/chrome/browser/policy/machine_level_user_cloud_policy_controller.h
[modify] https://crrev.com/0b002e19449048dd96a03aa92b50f96cf27091db/chrome/browser/policy/machine_level_user_cloud_policy_register_watcher.cc
[modify] https://crrev.com/0b002e19449048dd96a03aa92b50f96cf27091db/chrome/browser/policy/machine_level_user_cloud_policy_register_watcher.h

Project Member

Comment 4 by bugdroid1@chromium.org, Jul 16

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

commit 3bcf8d1547a70f6c13edd3b6f743b07c036da4f2
Author: Owen Min <zmin@chromium.org>
Date: Mon Jul 16 16:50:39 2018

Fix an issue that applicationDidFinishLaunching is not repposted properly.

The applicationDidFinishLaunching should be ran when controller is NOT nil.
Also, make it more clear that the notification is ran right after
the dialog is closed.

Bug:  844487 
Change-Id: I8a66c0e79af92234fba9a19dcc36f11f3edb7545
Reviewed-on: https://chromium-review.googlesource.com/1134473
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575308}
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/app_controller_mac.h
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/app_controller_mac.mm
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/chrome_browser_main.cc
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/policy/cloud/machine_level_user_cloud_policy_browsertest.cc
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/policy/machine_level_user_cloud_policy_controller.h
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/policy/machine_level_user_cloud_policy_register_watcher.cc
[modify] https://crrev.com/3bcf8d1547a70f6c13edd3b6f743b07c036da4f2/chrome/browser/policy/machine_level_user_cloud_policy_register_watcher_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment