|
|
Created:
5 years, 5 months ago by erikchen Modified:
5 years, 5 months ago Reviewers:
Robert Sesek CC:
chromium-reviews Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptionmac: Fix five browser_tests on Yosemite.
After a browser test creates or destroys a browser window, it should call
AutoreleasePool()->Recycle to ensure the resources are synchronously destroyed.
Failing to do so can cause race conditions in the tear down of the test.
This CL fixes
BrowserCloseManagerBrowserTest.*
ChromeServiceWorkerTest.CanCloseIncognitoWindowWithServiceWorkerController
SettingsWindowManagerTest.*
StartupBrowserCreatorTest.*
ZoomDecorationTest.CloseBrowserWithOpenBubble
BUG=445495
Patch Set 1 #Patch Set 2 : Add ifdefs. #
Messages
Total messages: 14 (5 generated)
erikchen@chromium.org changed reviewers: + rsesek@chromium.org
rsesek: Please review.
The CQ bit was checked by erikchen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1229473002/1
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_d...) android_compile_dbg on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_compile...) (exceeded global retry quota)
The CQ bit was checked by erikchen@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1229473002/20001
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
This seems like a fragile way to go about fixing these issues, and new tests will have to remember to do this correctly as well. Why is the base::RunLoop not draining the autorelease pool?
On 2015/07/07 15:49:24, Robert Sesek wrote: > This seems like a fragile way to go about fixing these issues, and new tests > will have to remember to do this correctly as well. Why is the base::RunLoop not > draining the autorelease pool? Are you referring to manually draining the pool after the creation of a Browser(), after the destruction, or both? The problem is that the main thread's RunLoop isn't actually running during the test. I added a base::debug::StackTrace to the constructor of base::RunLoop. The entirety of an in-process browser test is run within the context of PreMainMessageLoopRun(). I don't have a great solution to this problem short of rewriting the architecture of in-process browser tests. Can you think of a better solution? 1 libbase.dylib 0x000000012422e263 base::debug::StackTrace::StackTrace() + 35 2 libbase.dylib 0x000000012433d548 base::RunLoop::RunLoop() + 120 3 libbase.dylib 0x000000012433d683 base::RunLoop::RunLoop() + 35 4 browser_tests 0x0000000113d30672 content::MessageLoopRunner::MessageLoopRunner() + 66 5 browser_tests 0x0000000113d306c3 content::MessageLoopRunner::MessageLoopRunner() + 35 6 browser_tests 0x0000000113d30f8c content::WindowedNotificationObserver::Wait() + 92 7 browser_tests 0x000000010e61e061 SettingsWindowManagerTest::CloseBrowserSynchronously(Browser*) + 129 8 browser_tests 0x000000010e61e4d7 SettingsWindowManagerTest::CloseNonDefaultBrowsers() + 263 9 browser_tests 0x000000010e61d62c SettingsWindowManagerTest_OpenChromePages_Test::RunTestOnMainThread() + 828 10 browser_tests 0x00000001100c5490 InProcessBrowserTest::RunTestOnMainThreadLoop() + 640 11 browser_tests 0x0000000113c55ec9 content::BrowserTestBase::ProxyRunTestOnMainThreadLoop() + 313 12 browser_tests 0x0000000113c57a37 base::internal::RunnableAdapter<void (content::BrowserTestBase::*)()>::Run(content::BrowserTestBase*) + 119 13 browser_tests 0x0000000113c57907 base::internal::InvokeHelper<false, void, base::internal::RunnableAdapter<void (content::BrowserTestBase::*)()>, base::internal::TypeList<content::BrowserTestBase* const&> >::MakeItSo(base::internal::RunnableAdapter<void (content::BrowserTestBase::*)()>, content::BrowserTestBase* const&) + 55 14 browser_tests 0x0000000113c578ae base::internal::Invoker<base::IndexSequence<0ul>, base::internal::BindState<base::internal::RunnableAdapter<void (content::BrowserTestBase::*)()>, void (content::BrowserTestBase*), base::internal::TypeList<content::BrowserTestBase*> >, base::internal::TypeList<base::internal::UnwrapTraits<content::BrowserTestBase*> >, base::internal::InvokeHelper<false, void, base::internal::RunnableAdapter<void (content::BrowserTestBase::*)()>, base::internal::TypeList<content::BrowserTestBase* const&> >, void ()>::Run(base::internal::BindStateBase*) + 94 15 browser_tests 0x000000010d78e4ef base::Callback<void ()>::Run() const + 63 16 browser_tests 0x000000010ebbbec5 ChromeBrowserMainParts::PreMainMessageLoopRunImpl() + 5125 17 browser_tests 0x000000010ebba9fa ChromeBrowserMainParts::PreMainMessageLoopRun() + 330 18 libcontent.dylib 0x000000012885aaf2 content::BrowserMainLoop::PreMainMessageLoopRun() + 370 19 libcontent.dylib 0x0000000128868f47 base::internal::RunnableAdapter<int (content::BrowserMainLoop::*)()>::Run(content::BrowserMainLoop*) + 119 20 libcontent.dylib 0x0000000128868eaa base::internal::InvokeHelper<false, int, base::internal::RunnableAdapter<int (content::BrowserMainLoop::*)()>, base::internal::TypeList<content::BrowserMainLoop*> >::MakeItSo(base::internal::RunnableAdapter<int (content::BrowserMainLoop::*)()>, content::BrowserMainLoop*) + 58 21 libcontent.dylib 0x0000000128868e46 base::internal::Invoker<base::IndexSequence<0ul>, base::internal::BindState<base::internal::RunnableAdapter<int (content::BrowserMainLoop::*)()>, int (content::BrowserMainLoop*), base::internal::TypeList<base::internal::UnretainedWrapper<content::BrowserMainLoop> > >, base::internal::TypeList<base::internal::UnwrapTraits<base::internal::UnretainedWrapper<content::BrowserMainLoop> > >, base::internal::InvokeHelper<false, int, base::internal::RunnableAdapter<int (content::BrowserMainLoop::*)()>, base::internal::TypeList<content::BrowserMainLoop*> >, int ()>::Run(base::internal::BindStateBase*) + 102 22 libcontent.dylib 0x0000000128fa99ff base::Callback<int ()>::Run() const + 63 23 libcontent.dylib 0x0000000129526bbd content::StartupTaskRunner::RunAllTasksNow() + 109 24 libcontent.dylib 0x0000000128858c21 content::BrowserMainLoop::CreateStartupTasks() + 1153 25 libcontent.dylib 0x000000012886c351 content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&) + 849 26 libcontent.dylib 0x000000012885570d content::BrowserMain(content::MainFunctionParams const&) + 189 27 libcontent.dylib 0x00000001286279d7 content::RunNamedProcessTypeMain(std::string const&, content::MainFunctionParams const&, content::ContentMainDelegate*) + 247 28 libcontent.dylib 0x0000000128628bb1 content::ContentMainRunnerImpl::Run() + 577 29 libcontent.dylib 0x0000000128627040 content::ContentMain(content::ContentMainParams const&) + 144 30 browser_tests 0x0000000113c55c32 content::BrowserTestBase::SetUp() + 1202 31 browser_tests 0x00000001100c3fed InProcessBrowserTest::SetUp() + 1197 32 browser_tests 0x00000001104d0368 void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 136 33 browser_tests 0x00000001104bd46c void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) + 124 34 browser_tests 0x00000001104b0661 testing::Test::Run() + 129 35 browser_tests 0x00000001104b1026 testing::TestInfo::Run() + 230 36 browser_tests 0x00000001104b1815 testing::TestCase::Run() + 245 37 browser_tests 0x00000001104b77bd testing::internal::UnitTestImpl::RunAllTests() + 733 38 browser_tests 0x00000001104d3e98 bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 136 39 browser_tests 0x00000001104bf98f bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) + 127 40 browser_tests 0x00000001104b749d testing::UnitTest::Run() + 205 41 browser_tests 0x000000011017b2e3 RUN_ALL_TESTS() + 35 42 browser_tests 0x0000000110179df9 base::TestSuite::Run() + 169 43 browser_tests 0x000000010e86eb10 ChromeBrowserTestSuiteRunner::RunTestSuite(int, char**) + 64 44 browser_tests 0x00000001100c04fe (anonymous namespace)::ChromeTestLauncherDelegate::RunTestSuite(int, char**) + 78 45 browser_tests 0x0000000113d22403 content::LaunchTests(content::TestLauncherDelegate*, int, int, char**) + 611 46 browser_tests 0x00000001100c036c LaunchChromeTests(int, ChromeTestSuiteRunner*, int, char**) + 76 47 browser_tests 0x000000010e86e9a6 main + 118 48 browser_tests 0x000000010d6d8f04 start + 52 49 ??? 0x0000000000000006 0x0 + 6
On 2015/07/07 22:12:25, erikchen wrote: > On 2015/07/07 15:49:24, Robert Sesek wrote: > > This seems like a fragile way to go about fixing these issues, and new tests > > will have to remember to do this correctly as well. Why is the base::RunLoop > not > > draining the autorelease pool? > > Are you referring to manually draining the pool after the creation of a > Browser(), after the destruction, or both? Both, really. > The problem is that the main thread's RunLoop isn't actually running during the > test. I added a base::debug::StackTrace to the constructor of base::RunLoop. The > entirety of an in-process browser test is run within the context of > PreMainMessageLoopRun(). I don't have a great solution to this problem short of > rewriting the architecture of in-process browser tests. Can you think of a > better solution? This is where the RunLoop is created. But presumably all the observer-waiters Run() that loop while waiting for a notification/event to occur. What kind of MessagePump is running that loop, and why isn't an autorelease pool present? > > 1 libbase.dylib 0x000000012422e263 > base::debug::StackTrace::StackTrace() + 35 > 2 libbase.dylib 0x000000012433d548 > base::RunLoop::RunLoop() + 120 > 3 libbase.dylib 0x000000012433d683 > base::RunLoop::RunLoop() + 35 > 4 browser_tests 0x0000000113d30672 > content::MessageLoopRunner::MessageLoopRunner() + 66 > 5 browser_tests 0x0000000113d306c3 > content::MessageLoopRunner::MessageLoopRunner() + 35 > 6 browser_tests 0x0000000113d30f8c > content::WindowedNotificationObserver::Wait() + 92 > 7 browser_tests 0x000000010e61e061 > SettingsWindowManagerTest::CloseBrowserSynchronously(Browser*) + 129 > 8 browser_tests 0x000000010e61e4d7 > SettingsWindowManagerTest::CloseNonDefaultBrowsers() + 263 > 9 browser_tests 0x000000010e61d62c > SettingsWindowManagerTest_OpenChromePages_Test::RunTestOnMainThread() + 828 > 10 browser_tests 0x00000001100c5490 > InProcessBrowserTest::RunTestOnMainThreadLoop() + 640 > 11 browser_tests 0x0000000113c55ec9 > content::BrowserTestBase::ProxyRunTestOnMainThreadLoop() + 313 > 12 browser_tests 0x0000000113c57a37 > base::internal::RunnableAdapter<void > (content::BrowserTestBase::*)()>::Run(content::BrowserTestBase*) + 119 > 13 browser_tests 0x0000000113c57907 > base::internal::InvokeHelper<false, void, base::internal::RunnableAdapter<void > (content::BrowserTestBase::*)()>, > base::internal::TypeList<content::BrowserTestBase* const&> > >::MakeItSo(base::internal::RunnableAdapter<void > (content::BrowserTestBase::*)()>, content::BrowserTestBase* const&) + 55 > 14 browser_tests 0x0000000113c578ae > base::internal::Invoker<base::IndexSequence<0ul>, > base::internal::BindState<base::internal::RunnableAdapter<void > (content::BrowserTestBase::*)()>, void (content::BrowserTestBase*), > base::internal::TypeList<content::BrowserTestBase*> >, > base::internal::TypeList<base::internal::UnwrapTraits<content::BrowserTestBase*> > >, base::internal::InvokeHelper<false, void, > base::internal::RunnableAdapter<void (content::BrowserTestBase::*)()>, > base::internal::TypeList<content::BrowserTestBase* const&> >, void > ()>::Run(base::internal::BindStateBase*) + 94 > 15 browser_tests 0x000000010d78e4ef base::Callback<void > ()>::Run() const + 63 > 16 browser_tests 0x000000010ebbbec5 > ChromeBrowserMainParts::PreMainMessageLoopRunImpl() + 5125 > 17 browser_tests 0x000000010ebba9fa > ChromeBrowserMainParts::PreMainMessageLoopRun() + 330 > 18 libcontent.dylib 0x000000012885aaf2 > content::BrowserMainLoop::PreMainMessageLoopRun() + 370 > 19 libcontent.dylib 0x0000000128868f47 > base::internal::RunnableAdapter<int > (content::BrowserMainLoop::*)()>::Run(content::BrowserMainLoop*) + 119 > 20 libcontent.dylib 0x0000000128868eaa > base::internal::InvokeHelper<false, int, base::internal::RunnableAdapter<int > (content::BrowserMainLoop::*)()>, > base::internal::TypeList<content::BrowserMainLoop*> > >::MakeItSo(base::internal::RunnableAdapter<int > (content::BrowserMainLoop::*)()>, content::BrowserMainLoop*) + 58 > 21 libcontent.dylib 0x0000000128868e46 > base::internal::Invoker<base::IndexSequence<0ul>, > base::internal::BindState<base::internal::RunnableAdapter<int > (content::BrowserMainLoop::*)()>, int (content::BrowserMainLoop*), > base::internal::TypeList<base::internal::UnretainedWrapper<content::BrowserMainLoop> > > >, > base::internal::TypeList<base::internal::UnwrapTraits<base::internal::UnretainedWrapper<content::BrowserMainLoop> > > >, base::internal::InvokeHelper<false, int, > base::internal::RunnableAdapter<int (content::BrowserMainLoop::*)()>, > base::internal::TypeList<content::BrowserMainLoop*> >, int > ()>::Run(base::internal::BindStateBase*) + 102 > 22 libcontent.dylib 0x0000000128fa99ff base::Callback<int > ()>::Run() const + 63 > 23 libcontent.dylib 0x0000000129526bbd > content::StartupTaskRunner::RunAllTasksNow() + 109 > 24 libcontent.dylib 0x0000000128858c21 > content::BrowserMainLoop::CreateStartupTasks() + 1153 > 25 libcontent.dylib 0x000000012886c351 > content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&) + > 849 > 26 libcontent.dylib 0x000000012885570d > content::BrowserMain(content::MainFunctionParams const&) + 189 > 27 libcontent.dylib 0x00000001286279d7 > content::RunNamedProcessTypeMain(std::string const&, content::MainFunctionParams > const&, content::ContentMainDelegate*) + 247 > 28 libcontent.dylib 0x0000000128628bb1 > content::ContentMainRunnerImpl::Run() + 577 > 29 libcontent.dylib 0x0000000128627040 > content::ContentMain(content::ContentMainParams const&) + 144 > 30 browser_tests 0x0000000113c55c32 > content::BrowserTestBase::SetUp() + 1202 > 31 browser_tests 0x00000001100c3fed > InProcessBrowserTest::SetUp() + 1197 > 32 browser_tests 0x00000001104d0368 void > testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, > void>(testing::Test*, void (testing::Test::*)(), char const*) + 136 > 33 browser_tests 0x00000001104bd46c void > testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, > void>(testing::Test*, void (testing::Test::*)(), char const*) + 124 > 34 browser_tests 0x00000001104b0661 testing::Test::Run() > + 129 > 35 browser_tests 0x00000001104b1026 > testing::TestInfo::Run() + 230 > 36 browser_tests 0x00000001104b1815 > testing::TestCase::Run() + 245 > 37 browser_tests 0x00000001104b77bd > testing::internal::UnitTestImpl::RunAllTests() + 733 > 38 browser_tests 0x00000001104d3e98 bool > testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, > bool>(testing::internal::UnitTestImpl*, bool > (testing::internal::UnitTestImpl::*)(), char const*) + 136 > 39 browser_tests 0x00000001104bf98f bool > testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, > bool>(testing::internal::UnitTestImpl*, bool > (testing::internal::UnitTestImpl::*)(), char const*) + 127 > 40 browser_tests 0x00000001104b749d > testing::UnitTest::Run() + 205 > 41 browser_tests 0x000000011017b2e3 RUN_ALL_TESTS() + 35 > 42 browser_tests 0x0000000110179df9 > base::TestSuite::Run() + 169 > 43 browser_tests 0x000000010e86eb10 > ChromeBrowserTestSuiteRunner::RunTestSuite(int, char**) + 64 > 44 browser_tests 0x00000001100c04fe (anonymous > namespace)::ChromeTestLauncherDelegate::RunTestSuite(int, char**) + 78 > 45 browser_tests 0x0000000113d22403 > content::LaunchTests(content::TestLauncherDelegate*, int, int, char**) + 611 > 46 browser_tests 0x00000001100c036c > LaunchChromeTests(int, ChromeTestSuiteRunner*, int, char**) + 76 > 47 browser_tests 0x000000010e86e9a6 main + 118 > 48 browser_tests 0x000000010d6d8f04 start + 52 > 49 ??? 0x0000000000000006 0x0 + 6
Message was sent while issue was closed.
Better solution incoming: https://codereview.chromium.org/1228723002/ |