New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 821036 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 1
Type: Bug



Sign in to add a comment

Chrome crashes on start up under mash

Project Member Reported by xiy...@chromium.org, Mar 12 2018

Issue description

Repro:
1. Enable mash by adding "enable-features=Mash" to /etc/chrome_dev.conf
2. "restart ui" to restart chrome under mash

At step 2, chrome crashes on start up. Looks like introduced by
https://chromium-review.googlesource.com/c/chromium/src/+/942649

Crash stack:
rogram terminated with signal SIGSEGV, Segmentation fault.
#0  chromeos::power::ml::UserActivityLoggingController::UserActivityLoggingController () at ../../chrome/browser/chromeos/power/ml/user_activity_logging_controller.cc:42
42            ->GetHostFrameSinkManager()
(gdb) bt
#0  chromeos::power::ml::UserActivityLoggingController::UserActivityLoggingController () at ../../chrome/browser/chromeos/power/ml/user_activity_logging_controller.cc:42
#1  0x000056758f290034 in make_unique<chromeos::power::ml::UserActivityLoggingController> ()
    at /usr/local/google/home/xiyuan/src/cros/.cache/chrome-sdk/tarballs/samus+10468.0.0+target_toolchain/usr/bin/../include/c++/v1/memory:3011
#2  chromeos::ChromeBrowserMainPartsChromeos::PostBrowserStart () at ../../chrome/browser/chromeos/chrome_browser_main_chromeos.cc:1049
#3  0x000056758ff03c9c in ChromeBrowserMainParts::PreMainMessageLoopRunImpl () at ../../chrome/browser/chrome_browser_main.cc:2114
#4  0x000056758ff02c5a in ChromeBrowserMainParts::PreMainMessageLoopRun () at ../../chrome/browser/chrome_browser_main.cc:1442
#5  0x000056758f28ec39 in chromeos::ChromeBrowserMainPartsChromeos::PreMainMessageLoopRun () at ../../chrome/browser/chromeos/chrome_browser_main_chromeos.cc:710
#6  0x000056758e8dfb1e in content::BrowserMainLoop::PreMainMessageLoopRun () at ../../content/browser/browser_main_loop.cc:1040
#7  0x000056758ec65637 in Run () at ../../base/callback.h:124
#8  content::StartupTaskRunner::RunAllTasksNow () at ../../content/browser/startup_task_runner.cc:45
#9  0x000056758e8de405 in content::BrowserMainLoop::CreateStartupTasks () at ../../content/browser/browser_main_loop.cc:954
#10 0x000056758e8e22a0 in content::BrowserMainRunnerImpl::Initialize () at ../../content/browser/browser_main_runner.cc:139
#11 0x000056758e8dbeac in content::BrowserMain () at ../../content/browser/browser_main.cc:42
#12 0x000056758fef0783 in content::ContentMainRunnerImpl::Run () at ../../content/app/content_main_runner.cc:703
#13 0x000056758fef9e87 in service_manager::Main () at ../../services/service_manager/embedder/main.cc:453
#14 0x000056758feef361 in content::ContentMain () at ../../content/app/content_main.cc:19
#15 0x000056758df5fe7c in ChromeMain () at ../../chrome/app/chrome_main.cc:101
#16 0x00007bf21ebde736 in __libc_start_main (main=0x56758df5fde0 <main()>, argc=32, argv=0x7ffcb2cf29c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, 
    stack_end=0x7ffcb2cf29b8) at ../csu/libc-start.c:289
#17 0x000056758df5fca9 in _start ()



 
+sky/fsamuel - I seem to recall that mash/viz doesn't have a "context_factory_private" in the browser process, though I'm not quite sure what that does.

https://cs.chromium.org/chromium/src/chrome/browser/chromeos/power/ml/user_activity_logging_controller.cc?q=useractivityloggingcontroller&sq=package:chromium&dr=CSs&l=41

Hello,

Thanks for letting me know. I'm not familiar with mash, but our code works (and has been tested) under non-mash environment. I'd really appreciate it if you could suggested a workaround under mash. 

Here is a bit of background. We are working on a project that uses ML to improve power management. Video events are important signals for us.  We have been suggested not to use ash's video detector and we should implement our own viz::mojom::VideoDetectorObserver. In order to be notified about the video events, we have to call AddVideoDetectorObserver (https://cs.chromium.org/chromium/src/chrome/browser/chromeos/power/ml/user_activity_logging_controller.cc?dr=CSs&l=40) to register ourselves. I looked at how we could register our impl under mash, but the required components are buried very deep in ash. As mash wouldn't be rolled out any time soon, I put in the non-mash solution. 

Thanks,
Jia





Comment 3 by xiy...@chromium.org, Mar 12 2018

Cc: sky@chromium.org fsam...@chromium.org
+sky/fsamuel for real

Would ash::VideoActivityNotifier [1] provide enough info? How would you consume the video signal? If you need to send it to a server, then you would need some mojo interface to send the info from ash to the browser.

[1]: https://cs.chromium.org/chromium/src/ash/system/power/video_activity_notifier.cc?rcl=ca530111ae4446bc1492d10f96356b700d7b4978&l=37
Yes ash::VideoActivityNotifier would give us the info we need and it'd be really good if we could use it. We only implemented our own because we were advised not to use it. :(

Re how we're using video signals, we only need to be notified when video starts to play and when it ends. 

Thanks.
Jia 

Comment 5 by xiy...@chromium.org, Mar 12 2018

It looks like you need the video start/stop signal in the browser process where chrome/browser/chromeos/power/ml code runs. ash::VideoActivityNotifier runs in ash so we would need some mojo interface to pass the info back to the browser.

sky/fsamuel, do we already have API/sample to detect video activity in the browser? Can we bind to VideoDetector interface in browser (its comment says it is a privileged interface)?
Thanks a lot for this. Can we register our class as an observer of ash's VideoDetector? (https://cs.chromium.org/chromium/src/ash/wm/video_detector.h?type=cs&l=35)

We have another related project (also under power/ml) that needs to listen to video start/end signals well. What do you think is the best way to receive video signals?

Thanks!
Jia

Comment 7 by xiy...@chromium.org, Mar 13 2018

You cannot use ash::VideoDetector directly since it runs in ash and would be in a separate process other than the browser process under mash. I was thinking of something like
  https://cs.chromium.org/chromium/src/ash/shell_port_mus.cc?rcl=dd85a2211af3a16c4a7330196b2529157c9a0eb0&l=287-289

when saying bind to VideoDetector interface. But I am not sure whether it is allowed from the browser process. Please get an approval from security owners (//ipc/SECURITY_OWNERS) before doing that.

If that is not allowed, we need to have the observer code running in ash and have a mojo interface (in //ash/public/interfaces/) to pass back the info to c/b/chromeos/power/ml code running in the browser process.

Meanwhile, could you put the context_factory_private() access code under 
  if (chromeos::GetAshConfig() != ash::Config::MASH)
to exclude it from running under mash ?

Comment 8 by sky@chromium.org, Mar 13 2018

I suspect this breaks auto-test. Please either revert, or add an early out for mash.

I believe you should be able to bind VideoDetector in the browser side too.
Thanks all, I'll put in a cl to exclude mash as a short term solution and will work on binding it in the browser side next.
Jia
Project Member

Comment 10 by bugdroid1@chromium.org, Mar 14 2018

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

commit d443126db5827163c6ea50f4c00c3d3d9829633c
Author: Jia <jiameng@chromium.org>
Date: Wed Mar 14 00:41:01 2018

Disable user activity logging if we're under MASH.

Bug:  821036 
Change-Id: I98e392f3dd60e4148fd04a164e3a9fe5580fe57f
Reviewed-on: https://chromium-review.googlesource.com/961165
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Jia Meng <jiameng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542969}
[modify] https://crrev.com/d443126db5827163c6ea50f4c00c3d3d9829633c/chrome/browser/chromeos/power/ml/user_activity_controller.cc

I've put in a short term solution so you won't see crash any more.

Would you know the percentage of chrome os users that have MASH enabled? 

Also, when would MASH be rolled out completely?

Thanks!
Jia
Thanks for landing the fix!

Mash is a long-term rearchitecture project. It will be several quarters before it rolls out. However, it's so big that we have to make new features work with it, otherwise we'll never finish the project. That's why there are mash_ash_unittests and mash_browser_tests in the CQ.

I'm a little surprised that mash_browser_tests didn't catch this. That implies there are no browser_tests that exercise this code path. Is it all tested with unit_tests? Or is this code path not tested?

Thanks a lot for this info! :)

The crash occurred in our logging controller class, which sets up all the objects and video connection. It doesn't have a unit test as it only sets up the objects, but I would imagine browser test would check it. Or is some other test script/file that I should update to include our controller class?

Thanks,
Jia
You should consider writing a browser test that exercises at least part of your feature end to end. There are lots of examples, look for files ending in _browsertest.cc. If this code talks to an underlying device daemon you might need to fake out that daemon, or simulate the answers it will give when the feature is turned on. I'm not sure why we only saw the crash on device and not linux-chromeos, maybe the code only runs when a flag is passed or a feature is enabled? If that's the case then the browser test will need to flip the flag.

Thanks James! I'll look into adding tests as suggested.

In the meantime, could someone please verify the crash has been fixed so that I'll close this ticket?

Thanks,
Jia
Yep, confirmed that the crash is gone under mash.
Status: Fixed (was: Assigned)
Thanks! :) I'm closing the ticket now.
Jia

Sign in to add a comment