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

Issue 894107 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 16
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Ash UI Devtool breaks when opening ChromeOS launcher

Project Member Reported by xiaoh...@chromium.org, Oct 10

Issue description

When trying to use the ash dev tool
https://www.chromium.org/developers/how-tos/inspecting-ash

It appears that the inspector tool will break whenever the launcher is triggered. Sometimes the overlay won't show, sometimes the devtool won't select the node when pinning a ui element. 

When the launcher is opening, there is a visible multi-seconds pause on the UI. Looking at the console log, there are thousands of these logs below that flush the screen.

[31611:31611:1010/101411.205174:ERROR:http_server.cc(99)] Write buffer is full.
[31611:31611:1010/101411.205191:ERROR:http_server.cc(99)] Write buffer is full.
[31611:31611:1010/101411.205207:ERROR:http_server.cc(99)] Write buffer is full.
[31611:31611:1010/101411.205244:ERROR:http_server.cc(99)] Write buffer is full.

Looking at the code, it seems the devtools is sending ui updates to the frontend through http web socket. The http server's buffer is overflowing by too many requests to update.

It appears the launcher has many views, a few hundreds, and the current devtool update algorithm is not very efficient, looks like O(n^2) where n is number of views. So it is sending tens of thousands of updates to the frontend all at once, which overflowed the http server buffer. 

I will take a first stab to see if we can make it fast.
 
I have experienced some crashes when using the devtools myself. I *think* there's some WindowElement/WidgetElement that's installing itself as an observer, but not removing as observer, or perhaps it's attempting to remove observer from an already destroyed window/widget. So there's possibly a use-after-free issue too.
Project Member

Comment 2 by bugdroid1@chromium.org, Oct 16

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

commit da1977a39eea2f806fd91e5d63685e6539ed8e7e
Author: Xiaohui Chen <xiaohuic@google.com>
Date: Tue Oct 16 20:13:02 2018

ui_devtools: optimize view tree updating logic

Currently when view tree is updating, we visit each view in this subtree
and for each view we rebuild the subtree with that view as root and
recurse. This causes very complicated view tree, e.g. ChromeOS launcher
to flood the HTTP websocket server and overrun the buffer.

Now we avoid rebuilding subtree if we already visited it, and only send
view tree update on the root view which covers the whole subtree.

Bug:  894107 
Test: locally build and run devtools with ChromeOS launcher
Change-Id: I53c87813729eb4983ce613628ae2b83e86adcd30
Reviewed-on: https://chromium-review.googlesource.com/c/1279357
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600094}
[modify] https://crrev.com/da1977a39eea2f806fd91e5d63685e6539ed8e7e/components/ui_devtools/dom_agent.cc
[modify] https://crrev.com/da1977a39eea2f806fd91e5d63685e6539ed8e7e/components/ui_devtools/dom_agent.h
[modify] https://crrev.com/da1977a39eea2f806fd91e5d63685e6539ed8e7e/components/ui_devtools/ui_element.h
[modify] https://crrev.com/da1977a39eea2f806fd91e5d63685e6539ed8e7e/components/ui_devtools/views/dom_agent_aura.cc

Status: Fixed (was: Untriaged)

Sign in to add a comment