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

Issue 758352 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Chrome_InProcGp thread hanging 200+ms only in WebView

Reported by b...@lucidchart.com, Aug 23 2017

Issue description

Steps to reproduce the problem:
1. Load a WebView in an Android app
2. Navigate to www.lucidchart.com/documents and log in/sign up
3. Create a new Lucidchart document from one of the templates
4. Navigate to www.lucidchart.com/documents/tabletNative/<docId> (automatically handled by the .apk attached when you try to open a document)
5. Touch & drag to pan around the document

Example code for the webview app:

WebView webView = (WebView) findViewById(R.id.webView);
webView.setWebViewClient(new WebViewClient());
WebSettings settings = webView.getSettings();
settings.setJavaScriptEnabled(true);

WebView.setWebContentsDebuggingEnabled(true);

webView.setWebViewClient(new WebViewClient() {
    public boolean shouldOverrideUrlLoading(WebView view, String url){
        url = url.replace("/viewer/", "/tabletNative/");
        view.loadUrl(url);
        return false;
    }
});

webView.loadUrl("https://www.lucidchart.com/documents");

What is the expected behavior?
It should pan at 60FPS like it does in the Chrome browser

What went wrong?
The view will freeze for hundreds of milliseconds several times shortly after you start dragging to pan around. There will be many fast frames, but some individual frames will be hundreds of milliseconds long.

systrace output shows the Chrome_InProcGp thread locking up a CPU thread for the duration of the lock.

I've attached systrace output from a Pixel C, both from the Chrome browser and from the attached .apk.

Did this work before? N/A 

Does this work in other browsers? Yes

Chrome version: 59.0.3071.125  Channel: stable
OS Version: 7.1.2
Flash Version: 

systrace appears to show the GPU itself mostly idle; not sure why this GPU-related CPU thread is hogging all the resources, and only in the WebView.
 
app-debug.apk
1.5 MB Download
pixel-traces.zip
2.7 MB Download

Comment 1 by kbr@chromium.org, Aug 24 2017

Cc: aelias@chromium.org boliu@chromium.org
Components: Blink>WebGL Mobile>WebView
Owner: boliu@chromium.org
Bo: this customer and I exchanged some emails about this problem with their app version of their website, which wraps WebView. I looked through their traces and could see the in-proc GPU taking a lot of time, but don't really know WebView's threading model. Could you take a look and see if you can figure out why it behaves so much worse in WebView than Chrome?

Comment 2 by boliu@chromium.org, Aug 24 2017

prefer chrome trace over systrace:
https://www.chromium.org/developers/how-tos/trace-event-profiling-tool/recording-tracing-runs#TOC-Capture-a-trace-from-Chrome-on-Android-with-DevTools-

and if you take systrace, include the "webview" category for webview

Webview has two "gpu" threads, android's "RenderThread" and chrome's "Chrome_InProcGp[u]". It *looks* like in this case, renderthread is blocked and while the chrome thread is running. They do use a lock to share egl image tracking state, but 180ms seems like a ridiculously long time for that. I think chrome trace with at least the default categories will at least identify what those threads threads are doing/waiting on

Comment 3 by boliu@chromium.org, Aug 24 2017

and for kbr, that lock is in mailbox_manager_sync

Comment 4 by b...@lucidchart.com, Aug 24 2017

Please let me know if there's additional information you need me to provide. I'm not sure how to run chrome://tracing on a connected device's webview though.

Comment 5 by torne@chromium.org, Aug 24 2017

The instructions for Chrome that Bo linked to also work for webview if you've enabled webview debugging in your app.

Comment 6 by boliu@chromium.org, Aug 24 2017

Yeah, webview article is two links down compared to chrome: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/webviews

Comment 7 Deleted

Comment 8 by b...@lucidchart.com, Aug 25 2017

Thanks, not sure how I missed it. I'll post some tracing output soon.
Cc: ntfschr@chromium.org
Labels: Needs-Feedback
Owner: ----
Ben, any update?
Sorry, this fell off my backlog for a little while. I'll get something up for you this week.
Project Member

Comment 11 by sheriffbot@chromium.org, Oct 4 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "ntfschr@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Needs-Feedback
Adding needs-feedback for the trace.
I've attached a trace from Chrome and a WebView on a Nexus 9. In the course of the several seconds recorded in the WebView, you'll see about 3 100-150ms pauses in the InProcGpu thread.
nexus9.tar.gz
3.0 MB Download
Project Member

Comment 14 by sheriffbot@chromium.org, Oct 10 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "ntfschr@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 15 by boliu@chromium.org, Oct 11 2017

Status: WontFix (was: Unconfirmed)
Are the original systraces from a nexus 9 as well? That explains a lot of things..

Nvidia driver does an cpu copy for every texture in nexus 9, and this only happens in webview. Apparently newer drivers fixed this, but nexus 9 is too old to get the update I think: https://bugs.chromium.org/p/chromium/issues/detail?id=492315#c74. And looking at the trace, that copy does indeed happen while that global lock is held.

Also nexus 9 was just a really slow device. It has 4 cores, but looking at that systrace, it can maybe only keep 2 of them running at the same time. The trace chrome shows there is non-stop javascript running on the blink main thread, which also competes with those 2 cores.

At this point, we really don't care that much about this, given the small population of nexus 9 and old nvidia devices in general, and given newer drivers have this fixed already. Sorry
No, the worst original traces were from a brand-new Jamboard. The effect there is so horrendous that it renders our application unusable. But we don't have a Jamboard in dev mode in our offices here so I had to repro on another device we had on hand (Nexus 9).

The other original traces were from a Pixel C, which also showed the effect but to a lesser degree (100ms pauses instead of 250ms+ pauses).
Note: Original traces posted here were only from the Pixel C; not sure what happened to the Jamboard traces, but they probably just put us over the attachment size limit, and we thought you might care about the Pixel C more than the Jamboard :-D

Sign in to add a comment