BackgroundFetchBrowserTest.FetchFromServiceWorker is pretty flaky |
||
Issue descriptionDescribe problem with existing test, or request for new test. This happens on https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Linux%20ChromiumOS%20MSan%20Tests What I am seeing is stack traces with postMessage being called on a null object: [8411:8700:0827/235638.499417:WARNING:embedded_test_server.cc(238)] Request not handled. Returning 404: /favicon.ico [8411:8411:0827/235638.645369:INFO:CONSOLE(44)] "sendResultToTest: ok - service worker registered", source: https://127.0.0.1:42246/result_queue.js (44) [8411:8411:0827/235638.663022:INFO:CONSOLE(139)] "Uncaught (in promise) TypeError: Cannot read property 'postMessage' of null", source: https://127.0.0.1:42246/background_fetch/background_fetch.js (139) BrowserTestBase received signal: Terminated. Backtrace: #0 0x000000ba9c31 in __interceptor_backtrace /b/swarming/w/ir/kitchen-workdir/src/third_party/llvm/compiler-rt/lib/msan/../sanitizer_common/sanitizer_common_interceptors.inc:4024:13 #1 0x00001485b9cf in base::debug::StackTrace::StackTrace(unsigned long) ./../../base/debug/stack_trace_posix.cc:814:41 #2 0x0000164db942 in content::(anonymous namespace)::DumpStackTraceSignalHandler(int) ./../../content/public/test/browser_test_base.cc:84:5 #3 0x000000bd16a9 in SignalHandler(int) /b/swarming/w/ir/kitchen-workdir/src/third_party/llvm/compiler-rt/lib/msan/msan_interceptors.cc:990:3 #4 0x7f570ff6bcb0 in killpg ??:? #5 0x7f570ff6bcb0 in ?? ??:0 #6 0x7f57100336d3 in epoll_wait /build/eglibc-ripdx6/eglibc-2.19/misc/../sysdeps/unix/syscall-template.S:81:0 #7 0x000000b92914 in __interceptor_epoll_wait /b/swarming/w/ir/kitchen-workdir/src/third_party/llvm/compiler-rt/lib/msan/msan_interceptors.cc:857:13 #8 0x0000184d144b in epoll_dispatch ./../../base/third_party/libevent/epoll.c:198:8 #9 0x0000184c484b in event_base_loop ./../../base/third_party/libevent/event.c:512:9 #10 0x0000148a8ab8 in base::MessagePumpLibevent::Run(base::MessagePump::Delegate*) ./../../base/message_loop/message_pump_libevent.cc:247:9 #11 0x0000146579c0 in base::RunLoop::Run() ./../../base/run_loop.cc:102:14 #12 0x0000164f8b39 in content::DOMMessageQueue::WaitForMessage(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) ./../../content/public/test/browser_test_utils.cc:2118:14 #13 0x0000164ecbd8 in content::(anonymous namespace)::ExecuteScriptHelper(content::RenderFrameHost*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, int, std::__1::unique_ptr<base::Value, std::__1::default_delete<base::Value> >*) ./../../content/public/test/browser_test_utils.cc:193:26 #14 0x0000164eb5bc in content::ExecuteScriptAndExtractString(content::ToRenderFrameHost const&, 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> >*) ./../../content/public/test/browser_test_utils.cc:1168:10 #15 0x000000f20cd0 in RunScript ./../../chrome/browser/background_fetch/background_fetch_browsertest.cc:270:12 #16 0x000000f20cd0 in BackgroundFetchBrowserTest::RunScriptAndCheckResultingMessage(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&) ./../../chrome/browser/background_fetch/background_fetch_browsertest.cc:238:0 #17 0x000000f231cf in BackgroundFetchBrowserTest_FetchFromServiceWorker_Test::RunTestOnMainThread() ./../../chrome/browser/background_fetch/background_fetch_browsertest.cc:563:3 #18 0x0000164d833c in content::BrowserTestBase::ProxyRunTestOnMainThreadLoop() ./../../content/public/test/browser_test_base.cc:406:5 #19 0x000014c6172f in Run ./../../base/callback.h:129:12 #20 0x000014c6172f in ChromeBrowserMainParts::PreMainMessageLoopRunImpl() ./../../chrome/browser/chrome_browser_main.cc:2004:0 #21 0x000014c5ce9c in ChromeBrowserMainParts::PreMainMessageLoopRun() ./../../chrome/browser/chrome_browser_main.cc:1388:18 #22 0x000007db653e in chromeos::ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun() ./../../chrome/browser/chromeos/chrome_browser_main_chromeos.cc:692:32 #23 0x00000cc645fb in content::BrowserMainLoop::PreMainMessageLoopRun() ./../../content/browser/browser_main_loop.cc:1016:13 #24 0x00000e376add in Run ./../../base/callback.h:129:12 #25 0x00000e376add in content::StartupTaskRunner::RunAllTasksNow() ./../../content/browser/startup_task_runner.cc:43:0 #26 0x00000cc5c03b in content::BrowserMainLoop::CreateStartupTasks() ./../../content/browser/browser_main_loop.cc:927:25 #27 0x00000cc70b4a in content::BrowserMainRunnerImpl::Initialize(content::MainFunctionParams const&) ./../../content/browser/browser_main_runner_impl.cc:140:15 #28 0x00000cc50a46 in content::BrowserMain(content::MainFunctionParams const&) ./../../content/browser/browser_main.cc:43:32 #29 0x00001414e608 in RunBrowserProcessMain ./../../content/app/content_main_runner_impl.cc:536:10 #30 0x00001414e608 in content::ContentMainRunnerImpl::Run(bool) ./../../content/app/content_main_runner_impl.cc:889:0 #31 0x00001eae3e11 in service_manager::Main(service_manager::MainParams const&) ./../../services/service_manager/embedder/main.cc:472:29 #32 0x000014145aa5 in content::ContentMain(content::ContentMainParams const&) ./../../content/app/content_main.cc:19:10 #33 0x0000164d67ff in content::BrowserTestBase::SetUp() ./../../content/public/test/browser_test_base.cc:322:3 #34 0x000014a92550 in InProcessBrowserTest::SetUp() ./../../chrome/test/base/in_process_browser_test.cc:251:20 #35 0x000009531926 in testing::Test::Run() ./../../third_party/googletest/src/googletest/src/gtest.cc:0:0 #36 0x0000095359cc in testing::TestInfo::Run() ./../../third_party/googletest/src/googletest/src/gtest.cc:2682:11 #37 0x00000953748a in testing::TestCase::Run() ./../../third_party/googletest/src/googletest/src/gtest.cc:2800:28 #38 0x00000956d9a5 in testing::internal::UnitTestImpl::RunAllTests() ./../../third_party/googletest/src/googletest/src/gtest.cc:5124:43 #39 0x00000956c278 in testing::UnitTest::Run() ./../../third_party/googletest/src/googletest/src/gtest.cc:0:0 #40 0x000014b080a1 in RUN_ALL_TESTS ./../../third_party/googletest/src/googletest/include/gtest/gtest.h:2331:46 #41 0x000014b080a1 in base::TestSuite::Run() ./../../base/test/test_suite.cc:295:0 #42 0x0000144df28d in ChromeTestSuiteRunner::RunTestSuite(int, char**) ./../../chrome/test/base/chrome_test_launcher.cc:68:21 #43 0x000016589d2a in content::LaunchTests(content::TestLauncherDelegate*, unsigned long, int, char**) ./../../content/public/test/test_launcher.cc:645:31 #44 0x0000144e09d9 in LaunchChromeTests(unsigned long, content::TestLauncherDelegate*, int, char**) ./../../chrome/test/base/chrome_test_launcher.cc:173:10 #45 0x0000144df050 in main ./../../chrome/test/base/browser_tests_main_chromeos.cc:21:10 #46 0x7f570ff56f45 in __libc_start_main /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:287:0 #47 0x000000b6be0a in _start ??:0:0 [ RUN ] BackgroundFetchBrowserTest.FetchFromServiceWorker In https://cs.chromium.org/chromium/src/chrome/test/data/background_fetch/background_fetch.js?sq=package:chromium&dr&g=0&l=139 (the only call to postMessage) This makes me thing installation of service worker didn't work properly in sw.js: https://cs.chromium.org/chromium/src/chrome/test/data/background_fetch/sw.js I wonder if that could be due to scoping when we skip waiting: // Service Worker initialization listeners. self.addEventListener('install', e => e.waitUntil(skipWaiting())); self.addEventListener('activate', e => e.waitUntil(clients.claim())); I'd try to pre-pend "self." to both calls, but I am not an expert. Either way this test fails a lot.
,
Aug 30
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/874e39ef68ebd85f2fef45915f27aba3967ac1f9 commit 874e39ef68ebd85f2fef45915f27aba3967ac1f9 Author: Rayan Kanso <rayankans@chromium.org> Date: Thu Aug 30 10:38:19 2018 Fix flaky Background Fetch browser test. navigator.serviceWorker.controller was returning null sometimes. This CL changes the way the active registration is queried and posted to (similar to https://jakearchibald.github.io/isserviceworkerready/demos/postMessage/index.html Bug: 878605 Change-Id: I9ab08881db18a91933481ae7fabfe2ff25ce94f3 Reviewed-on: https://chromium-review.googlesource.com/1195505 Commit-Queue: Peter Beverloo <peter@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Cr-Commit-Position: refs/heads/master@{#587509} [modify] https://crrev.com/874e39ef68ebd85f2fef45915f27aba3967ac1f9/chrome/test/data/background_fetch/background_fetch.js
,
Sep 10
|
||
►
Sign in to add a comment |
||
Comment 1 by rayankans@chromium.org
, Aug 30