New issue
Advanced search Search tips

Issue 784192 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner: ----
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

TabCaptureApiTest.ApiTests fails on Linux MSAN bot

Project Member Reported by guidou@chromium.org, Nov 12 2017

Issue description

A recent patch that serializes getUserMedia() and MediaStreamTrack.stop() calls causes TabCaptureApiTest.ApiTests to fail reliably.

Sample logs

extension://ddchlicdkolnonkihahngkmmmjnjlkkf/api_tests.html (0)
[1421:1421:1111/111002.639870:INFO:CONSOLE(0)] "[SUCCESS] captureSameTab", source: chrome-extension://ddchlicdkolnonkihahngkmmmjnjlkkf/api_tests.html (0)
[1421:1421:1111/111002.711360:INFO:CONSOLE(0)] "Unchecked runtime.lastError while running tabs.update: Cannot update mute state for tab 2, tab has audio or video currently being captured
    at Object.callback (chrome-extension://ddchlicdkolnonkihahngkmmmjnjlkkf/api_tests.js:136:19)", source: chrome-extension://ddchlicdkolnonkihahngkmmmjnjlkkf/api_tests.html (0)
BrowserTestBase received signal: Terminated. Backtrace:
    #0 0x0000008d2831 in __interceptor_backtrace ??:0:0
    #1 0x00000d98402f in base::debug::StackTrace::StackTrace(unsigned long) base/debug/stack_trace_posix.cc:801:41
    #2 0x00000f3fc57a in content::(anonymous namespace)::DumpStackTraceSignalHandler(int) content/public/test/browser_test_base.cc:85:5
    #3 0x0000008bcfb9 in SignalHandler(int) ??:0:0
    #4 0x7fb8b13b6cb0 in killpg ??:?
    #5 0x7fb8b13b6cb0 in ?? ??:0
    #6 0x7fb8b1470c5d in __poll /build/eglibc-SvCtMH/eglibc-2.19/io/../sysdeps/unix/syscall-template.S:81:0
    #7 0x0000008d1487 in __interceptor_poll ??:0:0
    #8 0x7fb8b9ce609d in g_main_context_poll /home/tom/chromium/src/third_party/instrumented_libraries/scripts/out/Instrumented-msan-chained-origins-trusty/gen/third_party/instrumented_libraries/libglib2.0-0/glib2.0-2.40.2/glib/gmain.c:4028:11
    #9 0x7fb8b9ce609d in g_main_context_iterate /home/tom/chromium/src/third_party/instrumented_libraries/scripts/out/Instrumented-msan-chained-origins-trusty/gen/third_party/instrumented_libraries/libglib2.0-0/glib2.0-2.40.2/glib/gmain.c:3729:0
    #10 0x7fb8b9ce65ee in g_main_context_iteration /home/tom/chromium/src/third_party/instrumented_libraries/scripts/out/Instrumented-msan-chained-origins-trusty/gen/third_party/instrumented_libraries/libglib2.0-0/glib2.0-2.40.2/glib/gmain.c:3795:12
    #11 0x00000da1a775 in base::MessagePumpGlib::Run(base::MessagePump::Delegate*) base/message_loop/message_pump_glib.cc:305:30
    #12 0x00000daccf70 in base::RunLoop::Run() base/run_loop.cc:114:14
    #13 0x00000f5703a9 in content::RunThisRunLoop(base::RunLoop*) content/public/test/test_utils.cc:126:13
    #14 0x00002203a582 in extensions::ResultCatcher::GetNextResult() extensions/test/result_catcher.cc:35:5
    #15 0x0000043a9d66 in ExtensionApiTest::RunExtensionTestImpl(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, char const*, int) chrome/browser/extensions/extension_apitest.cc:365:16
    #16 0x000003f66535 in extensions::(anonymous namespace)::TabCaptureApiTest_ApiTests_Test::RunTestOnMainThread() chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc:157:3
    #17 0x00000f3fba94 in content::BrowserTestBase::ProxyRunTestOnMainThreadLoop() content/public/test/browser_test_base.cc:342:5
    #18 0x00000ee93492 in Run base/callback.h:94:12
    #19 0x00000ee93492 in ChromeBrowserMainParts::PreMainMessageLoopRunImpl() chrome/browser/chrome_browser_main.cc:1865:0
    #20 0x00000ee8eafa in ChromeBrowserMainParts::PreMainMessageLoopRun() chrome/browser/chrome_browser_main.cc:1195:18
    #21 0x0000079c4daa in content::BrowserMainLoop::PreMainMessageLoopRun() content/browser/browser_main_loop.cc:1189:13
    #22 0x000008ca97ae in Run base/callback.h:94:12
    #23 0x000008ca97ae in content::StartupTaskRunner::RunAllTasksNow() content/browser/startup_task_runner.cc:45:0
    #24 0x0000079bc403 in content::BrowserMainLoop::CreateStartupTasks() content/browser/browser_main_loop.cc:973:25
    #25 0x0000079d6b35 in content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&) content/browser/browser_main_runner.cc:119:17
    #26 0x0000079b0bcc in content::BrowserMain(content::MainFunctionParams const&) content/browser/browser_main.cc:42:32
    #27 0x00000d904864 in content::RunNamedProcessTypeMain(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, content::MainFunctionParams const&, content::ContentMainDelegate*) content/app/content_main_runner.cc:427:14
    #28 0x00000d907927 in content::ContentMainRunnerImpl::Run() content/app/content_main_runner.cc:705:12
    #29 0x00001561d9c3 in service_manager::Main(service_manager::MainParams const&) services/service_manager/embedder/main.cc:456:29
    #30 0x00000d900ecf in content::ContentMain(content::ContentMainParams const&) content/app/content_main.cc:19:10
    #31 0x00000f3fa57c in content::BrowserTestBase::SetUp() content/public/test/browser_test_base.cc:298:3
    #32 0x00000dd0756c in InProcessBrowserTest::SetUp() chrome/test/base/in_process_browser_test.cc:263:20
    #33 0x0000056b353c in testing::Test::Run() third_party/googletest/src/googletest/src/gtest-internal-inl.h:0:10
    #34 0x0000056b71a3 in testing::TestInfo::Run() third_party/googletest/src/googletest/src/gtest.cc:2654:11
    #35 0x0000056b8b5a in testing::TestCase::Run() third_party/googletest/src/googletest/src/gtest.cc:2772:28
    #36 0x0000056d9d45 in testing::internal::UnitTestImpl::RunAllTests() third_party/googletest/src/googletest/src/gtest.cc:4677:43
    #37 0x0000056d8b9a in testing::UnitTest::Run() third_party/googletest/src/googletest/src/gtest.cc:0:0
    #38 0x00000dd6862c in RUN_ALL_TESTS third_party/googletest/src/googletest/include/gtest/gtest.h:2237:46
    #39 0x00000dd6862c in base::TestSuite::Run() base/test/test_suite.cc:270:0
    #40 0x00000d946642 in ChromeTestSuiteRunner::RunTestSuite(int, char**) chrome/test/base/chrome_test_launcher.cc:72:38
    #41 0x00000f5542e0 in content::LaunchTests(content::TestLauncherDelegate*, unsigned long, int, char**) content/public/test/test_launcher.cc:639:31
    #42 0x00000d9476f4 in LaunchChromeTests(unsigned long, content::TestLauncherDelegate*, int, char**) chrome/test/base/chrome_test_launcher.cc:169:10
    #43 0x00000d946390 in main chrome/test/base/browser_tests_main.cc:36:10
    #44 0x7fb8b13a1f45 in __libc_start_main /build/eglibc-SvCtMH/eglibc-2.19/csu/libc-start.c:287:0
    #45 0x000000896f60 in _start ??:0:0

 

Comment 1 by guidou@chromium.org, Nov 12 2017

The patch has been reverted, but it should reland since it fixes an important bug.

It looks like the reason the test fails is that tabCapture.capture() first checks that no tab capture is actually running before issuing a getUserMedia() call to initiate tab capture and a previous call to stop() hasn't completely stop a previous tab capture.

MediaStreamTrack.stop() does not guarantee (neither before nor after the patch) that capture is actually ended after MediaStreamTrack.stop() completes.
This has been a source of races if multiple stop() and getUserMedia() calls are issued in quick succession (as in the test).

The new patch avoids races between getUserMedia() and stop() by putting them in the same queue for processing, which avoids failed getUserMedia() calls because a stop() hasn't really completed.

The check in tabCapture.capture() is obviously not in this queue and can fail due to races. It looks like stop() in the MSAN bot runs with sufficient delay for the check to fail in tabCapture.capture().

I think the only reasonable way to proceed is to disable the test in the MSAN bot, or to put some sleep after consecutive sequences of stop() and capture().

Comment 2 by guidou@chromium.org, Nov 13 2017

I'll try to land a patch that makes MST.stop() run more similarly as before to see if that makes the test pass on the MSAN bot.

If that does not work, I think the only choice is to disable the test.

Comment 3 by guidou@chromium.org, Nov 13 2017

The test passed on the first run with the relanded CL.
Will monitor a few more runs to see if it flakes. If it doesn't, I'll close this bug.

Comment 4 by guidou@chromium.org, Nov 13 2017

Status: Fixed (was: Untriaged)
It has run five times without flaking. Closing this, but will reopen if it starts flaking.

Sign in to add a comment