New issue
Advanced search Search tips

Issue 820287 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Mac: stale service manager causes tests to fail

Project Member Reported by lgrey@chromium.org, Mar 8 2018

Issue description

There are about a dozen unit test files that currently fail on Mac *after* the first test has run, with the following stack trace:

[21325:775:0308/172608.858218:4330792311351174:FATAL:sequenced_task_runner_handle.cc(33)] Check failed: ThreadTaskRunnerHandle::IsSet(). Error: This caller requires a sequenced context (i.e. the current task needs to run from a SequencedTaskRunner).
0   libbase.dylib                       0x000000012ff9f19e base::debug::StackTrace::StackTrace(unsigned long) + 174
1   libbase.dylib                       0x000000012ff9f25d base::debug::StackTrace::StackTrace(unsigned long) + 29
2   libbase.dylib                       0x000000012ff9d6dc base::debug::StackTrace::StackTrace() + 28
3   libbase.dylib                       0x0000000130036f4c logging::LogMessage::~LogMessage() + 460
4   libbase.dylib                       0x0000000130034c95 logging::LogMessage::~LogMessage() + 21
5   libbase.dylib                       0x000000013028a26a base::SequencedTaskRunnerHandle::Get() + 250
6   libbindings.dylib                   0x0000000129212806 mojo::internal::GetTaskRunnerToUseFromUserProvidedTaskRunner(scoped_refptr<base::SingleThreadTaskRunner>) + 278
7   libbindings.dylib                   0x00000001291e3b8e mojo::internal::InterfacePtrStateBase::Bind(mojo::ScopedHandleBase<mojo::MessagePipeHandle>, unsigned int, scoped_refptr<base::SingleThreadTaskRunner>) + 958
8   unit_tests                          0x0000000110b7d396 mojo::internal::InterfacePtrState<resource_coordinator::mojom::PageSignalGenerator>::Bind(mojo::InterfacePtrInfo<resource_coordinator::mojom::PageSignalGenerator>, scoped_refptr<base::SingleThreadTaskRunner>) + 358
9   unit_tests                          0x0000000110b7d0f3 mojo::InterfacePtr<resource_coordinator::mojom::PageSignalGenerator>::Bind(mojo::InterfacePtrInfo<resource_coordinator::mojom::PageSignalGenerator>, scoped_refptr<base::SingleThreadTaskRunner>) + 131
10  unit_tests                          0x0000000110b78657 mojo::InterfaceRequest<resource_coordinator::mojom::PageSignalGenerator> mojo::MakeRequest<resource_coordinator::mojom::PageSignalGenerator>(mojo::InterfacePtr<resource_coordinator::mojom::PageSignalGenerator>*, scoped_refptr<base::SingleThreadTaskRunner>) + 135
11  unit_tests                          0x0000000110b78172 resource_coordinator::PageSignalReceiver::AddObserver(resource_coordinator::PageSignalObserver*) + 402
12  unit_tests                          0x0000000110f2f645 resource_coordinator::TabManager::ResourceCoordinatorSignalObserver::ResourceCoordinatorSignalObserver() + 85
13  unit_tests                          0x0000000110f2f685 resource_coordinator::TabManager::ResourceCoordinatorSignalObserver::ResourceCoordinatorSignalObserver() + 21
14  unit_tests                          0x0000000110f142ac resource_coordinator::TabManager::TabManager() + 1788
15  unit_tests                          0x0000000110f14575 resource_coordinator::TabManager::TabManager() + 21
16  unit_tests                          0x000000010f371997 TestingBrowserProcess::GetTabManager() + 135
17  unit_tests                          0x000000010f3698a0 (anonymous namespace)::ChromeUnitTestSuiteInitializer::OnTestStart(testing::TestInfo const&) + 1056
18  unit_tests                          0x000000010cd90d05 testing::internal::TestEventRepeater::OnTestStart(testing::TestInfo const&) + 133
19  unit_tests                          0x000000010cd8b531 testing::TestInfo::Run() + 113
20  unit_tests                          0x000000010cd8c96c testing::TestCase::Run() + 236
21  unit_tests                          0x000000010cda0905 testing::internal::UnitTestImpl::RunAllTests() + 885
22  unit_tests                          0x000000010cdb8e7e bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 126
23  unit_tests                          0x000000010cda0512 bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 114
24  unit_tests                          0x000000010cda03e9 testing::UnitTest::Run() + 409
25  unit_tests                          0x000000010f3bfa61 RUN_ALL_TESTS() + 17
26  unit_tests                          0x000000010f3bedb0 base::TestSuite::Run() + 352
27  unit_tests                          0x000000010f678fa0 content::UnitTestTestSuite::Run() + 48
28  unit_tests                          0x000000010f38e95d int base::internal::FunctorTraits<int (content::UnitTestTestSuite::*)(), void>::Invoke<content::UnitTestTestSuite*>(int (content::UnitTestTestSuite::*)(), content::UnitTestTestSuite*&&) + 125
29  unit_tests                          0x000000010f38e8a4 int base::internal::InvokeHelper<false, int>::MakeItSo<int (content::UnitTestTestSuite::* const&)(), content::UnitTestTestSuite*>(int (content::UnitTestTestSuite::* const&&&)(), content::UnitTestTestSuite*&&) + 68
30  unit_tests                          0x000000010f38e833 int base::internal::Invoker<base::internal::BindState<int (content::UnitTestTestSuite::*)(), base::internal::UnretainedWrapper<content::UnitTestTestSuite> >, int ()>::RunImpl<int (content::UnitTestTestSuite::* const&)(), std::__1::tuple<base::internal::UnretainedWrapper<content::UnitTestTestSuite> > const&, 0ul>(int (content::UnitTestTestSuite::* const&&&)(), std::__1::tuple<base::internal::UnretainedWrapper<content::UnitTestTestSuite> > const&&&, std::__1::integer_sequence<unsigned long, 0ul>) + 99
31  unit_tests                          0x000000010f38e76c base::internal::Invoker<base::internal::BindState<int (content::UnitTestTestSuite::*)(), base::internal::UnretainedWrapper<content::UnitTestTestSuite> >, int ()>::Run(base::internal::BindStateBase*) + 44
32  unit_tests                          0x000000010d5d349f base::OnceCallback<int ()>::Run() && + 95
33  unit_tests                          0x000000010f400b66 base::(anonymous namespace)::LaunchUnitTestsInternal(base::OnceCallback<int ()>, unsigned long, int, bool, base::OnceCallback<void ()>) + 390
34  unit_tests                          0x000000010f4009a0 base::LaunchUnitTests(int, char**, base::OnceCallback<int ()>) + 176
35  unit_tests                          0x000000010f38e538 main + 392
36  libdyld.dylib                       0x00007fff6f64f115 start + 1

Since the tests are re-run individually and pass, we don't see the bot fail, but it's slowing things down.

Investigation shows that destroying the service manager instance in teardown or using TestServiceManagerContext as a member fixes it, but it seems like this shouldn't be necessary.

Here's a sample run of unit_tests on my machine (with the fix above applied to CocoaProfileTests, so a few failures are missing).

Alternately, look at any recent CQ run and look at mac_chromium_rel_ng unit_tests stdout.

rockot@ do you know the best person to look at this?
 

Comment 1 by lgrey@chromium.org, Mar 8 2018

Description: Show this description
Here's where the ServiceManagerConnection gets created:
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
  * frame #0: 0x00000001295272e0 libcontent.dylib`content::ServiceManagerConnection::SetForProcess(connection=unique_ptr<content::ServiceManagerConnection, std::__1::default_delete<content::ServiceManagerConnection> > @ 0x00007ffeefbfc348) at service_manager_connection_impl.cc:360
    frame #1: 0x000000012bae43c3 libcontent.dylib`content::RenderProcessHostImpl::InitializeChannelProxy(this=0x0000000161003000) at render_process_host_impl.cc:1602
    frame #2: 0x000000012bae3cf6 libcontent.dylib`content::RenderProcessHostImpl::RenderProcessHostImpl(this=0x0000000161003000, browser_context=0x000000015f8218d8, storage_partition_impl=0x000000015fc5b4d0, is_for_guests_only=false) at render_process_host_impl.cc:1366
    frame #3: 0x000000012bae2244 libcontent.dylib`content::RenderProcessHostImpl::RenderProcessHostImpl(this=0x0000000161003000, browser_context=0x000000015f8218d8, storage_partition_impl=0x000000015fc5b4d0, is_for_guests_only=false) at render_process_host_impl.cc:1342
    frame #4: 0x000000012bae2198 libcontent.dylib`content::RenderProcessHostImpl::CreateRenderProcessHost(browser_context=0x000000015f8218d8, storage_partition_impl=0x000000015fc5b4d0, site_instance=0x000000015fc5b000, is_for_guests_only=false) at render_process_host_impl.cc:1268
    frame #5: 0x000000012bae22fd libcontent.dylib`content::RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost(browser_context=0x000000015f8218d8, storage_partition_impl=0x0000000000000000, site_instance=0x000000015fc5b000, is_for_guests_only=false) at render_process_host_impl.cc:1285
    frame #6: 0x000000012bb07809 libcontent.dylib`content::RenderProcessHostImpl::GetProcessHostForSiteInstance(browser_context=0x000000015f8218d8, site_instance=0x000000015fc5b000) at render_process_host_impl.cc:3570
    frame #7: 0x000000012bf6b8b3 libcontent.dylib`content::SiteInstanceImpl::GetProcess(this=0x000000015fc5b000) at site_instance_impl.cc:128
    frame #8: 0x000000012c0631e5 libcontent.dylib`content::WebContentsImpl::Init(this=0x000000016008fe00, params=0x00007ffeefbfe590) at web_contents_impl.cc:1754
    frame #9: 0x000000010692514a unit_tests`content::TestWebContents::Create(browser_context=0x000000015f8218d8, instance=scoped_refptr<content::SiteInstance> @ 0x00007ffeefbfe630) at test_web_contents.cc:47
    frame #10: 0x00000001068f3023 unit_tests`content::WebContentsTester::CreateTestWebContents(browser_context=0x000000015f8218d8, instance=<unavailable>) at web_contents_tester.cc:29
    frame #11: 0x00000001010217c0 unit_tests`sync_sessions::SyncSessionsWebContentsRouterTest::SetUp(this=0x000000015f8218a0) at sync_sessions_web_contents_router_unittest.cc:37
    frame #12: 0x00000001040120de unit_tests`void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(object=0x000000015f8218a0, method=11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="SetUp()")(), char const*) at gtest.cc:2401
    frame #13: 0x0000000103fede42 unit_tests`void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(object=0x000000015f8218a0, method=11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00, location="SetUp()")(), char const*) at gtest.cc:2456
    frame #14: 0x0000000103fedd24 unit_tests`testing::Test::Run(this=0x000000015f8218a0) at gtest.cc:2471
    frame #15: 0x0000000103feed8d unit_tests`testing::TestInfo::Run(this=0x000000015fc12680) at gtest.cc:2651
    frame #16: 0x0000000103ff015c unit_tests`testing::TestCase::Run(this=0x000000015fc12850) at gtest.cc:2769
    frame #17: 0x0000000103ffd36c unit_tests`testing::internal::UnitTestImpl::RunAllTests(this=0x000000015b60a6d0) at gtest.cc:4642
    frame #18: 0x00000001040150ae unit_tests`bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=0x000000015b60a6d0, method=a0 cf ff 03 01 00 00 00 00 00 00 00 00 00 00 00, location="auxiliary test code (environments or event listeners)")(), char const*) at gtest.cc:2401
    frame #19: 0x0000000103ffcf22 unit_tests`bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(object=0x000000015b60a6d0, method=a0 cf ff 03 01 00 00 00 00 00 00 00 00 00 00 00, location="auxiliary test code (environments or event listeners)")(), char const*) at gtest.cc:2456
    frame #20: 0x0000000103ffcdfd unit_tests`testing::UnitTest::Run(this=0x000000010f268df0) at gtest.cc:4256
    frame #21: 0x0000000106631ac1 unit_tests`RUN_ALL_TESTS() at gtest.h:2314
    frame #22: 0x0000000106630e10 unit_tests`base::TestSuite::Run(this=0x000000015fe99d90) at test_suite.cc:271
    frame #23: 0x00000001068e2680 unit_tests`content::UnitTestTestSuite::Run(this=0x00007ffeefbff738) at unittest_test_suite.cc:54
    frame #24: 0x0000000106600ffd unit_tests`int base::internal::FunctorTraits<int (content::UnitTestTestSuite::*)(), void>::Invoke<content::UnitTestTestSuite*>(method=50 26 8e 06 01 00 00 00 00 00 00 00 00 00 00 00, receiver_ptr=0x00007ffeefbfefa0)(), content::UnitTestTestSuite*&&) at bind_internal.h:447
    frame #25: 0x0000000106600f44 unit_tests`int base::internal::InvokeHelper<false, int>::MakeItSo<int (functor=0x00000001634042e0, args=0x00007ffeefbfefa0)(), content::UnitTestTestSuite*>(int (content::UnitTestTestSuite::* const&&&)(), content::UnitTestTestSuite*&&) at bind_internal.h:530
    frame #26: 0x0000000106600ed3 unit_tests`int base::internal::Invoker<base::internal::BindState<int (content::UnitTestTestSuite::*)(), base::internal::UnretainedWrapper<content::UnitTestTestSuite> >, int ()>::RunImpl<int (functor=0x00000001634042e0, bound=0x00000001634042f0, (null)=std::__1::index_sequence<0UL> @ 0x00007ffeefbfef78)(), std::__1::tuple<base::internal::UnretainedWrapper<content::UnitTestTestSuite> > const&, 0ul>(int (content::UnitTestTestSuite::* const&&&)(), std::__1::tuple<base::internal::UnretainedWrapper<content::UnitTestTestSuite> > const&&&, std::__1::integer_sequence<unsigned long, 0ul>) at bind_internal.h:604
    frame #27: 0x0000000106600e0c unit_tests`base::internal::Invoker<base::internal::BindState<int (content::UnitTestTestSuite::*)(), base::internal::UnretainedWrapper<content::UnitTestTestSuite> >, int ()>::Run(base=0x00000001634042c0) at bind_internal.h:586
    frame #28: 0x00000001078b250d unit_tests`base::RepeatingCallback<int ()>::Run(this=0x00007ffeefbff718) const & at callback.h:124
    frame #29: 0x0000000106672ba8 unit_tests`base::(anonymous namespace)::LaunchUnitTestsInternal(run_test_suite=0x00007ffeefbff718, parallel_jobs=1, default_batch_limit=10, use_job_objects=true, gtest_init=0x00007ffeefbff680)> const&, unsigned long, int, bool, base::RepeatingCallback<void ()> const&) at unit_test_launcher.cc:225
    frame #30: 0x00000001066729f3 unit_tests`base::LaunchUnitTests(argc=3, argv=0x00007ffeefbff8f8, run_test_suite=0x00007ffeefbff718)> const&) at unit_test_launcher.cc:576
    frame #31: 0x0000000106600be5 unit_tests`main(argc=3, argv=0x00007ffeefbff8f8) at run_all_unittests.cc:30
    frame #32: 0x00007fff5b852115 libdyld.dylib`start + 1

It does not get cleaned up before the next test is run.
Cc: fdoray@chromium.org
Labels: OS-Mac
Status: Available (was: Untriaged)
https://chromium.googlesource.com/chromium/src/+/69feeeb961bfd9ad599d6a4c04433be9c7a8435c
Is implicated in this issue.  

This call (g_browser_process->GetTabManager()) in chrome/test/base/chrome_unit_test_suite.cc is the last step that caused the Mac Bots to start failing.

The second link in the chain is the failure to cleanup ServiceManagerConnection after TestWebContents goes away

Sign in to add a comment