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

Issue 667776 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Closed: Oct 23
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

DCHECK triggering in RenderProcessHostImpl::WidgetHidden when running tests from a cmd prompt at lowered priority

Project Member Reported by mmenke@chromium.org, Nov 22 2016

Issue description

There's a DCHECK in RenderProcessHostImpl::WidgetHidden that I fairly reliably hit on Windows.  It looks like a widget is being added before the process has finished starting up, so we don't mark the process as not being backgrounded, and then when the widget is torn down, we crash, because the process is still marked as being backgrounded, which causes the DCHECK to trigger.
 

Comment 1 by gab@chromium.org, Nov 22 2016

Blocking: 560446
Cc: nick@chromium.org brucedaw...@chromium.org
Being able to hit this indicates a pretty bad bug. It means that a renderer processing visible content was running at background process priority which is bad for performance ( issue 560446 ).

The widget visible/hidden heuristic needs to be improved, it has too many failure modes..

Removing the DCHECK is hiding a bad issue IMO and I would advise against it.

Comment 2 by mmenke@chromium.org, Nov 22 2016

Cc: gab@chromium.org mmenke@chromium.org
Owner: ----
Status: Untriaged (was: Assigned)
Unassigning from me, then...  I don't have time to learn this code.  It does seem really easy to hit, and dealing with it on every branch is decreasing my productivity.

Comment 3 by gab@chromium.org, Nov 22 2016

A minimized repro use case would help, I've never hit this and always run local builds with DCHECK_ALWAYS_ON.. So it's probably got something to do with the specific use case you put your local build through?

Comment 4 by mmenke@chromium.org, Nov 22 2016

Are you sure it means the process is running at lower priority?  We haven't even called UpdateProcessPriority() yet, and I don't think we start processes at lower priority, right?  So is_process_backgrounded_ is true, but that's just because it's the default value.  Or do we start processes at lower priority, and I just didn't realize it?

Comment 5 by mmenke@chromium.org, Nov 22 2016

A minimized repro:  Run Chrome on Windows.  Run any single browser test on Windows.  If I don't attach a debugger on start, I'm seeing it 100% of the time.

Comment 7 by mmenke@chromium.org, Nov 22 2016

And to be clear - I'm seeing it without any local changes at all.  I am using a component build without nacl, but that's about it, in terms of build-time magic.

Comment 8 by mmenke@chromium.org, Nov 22 2016

Ah, you're right, I was thinking it was true.  Just calling UpdateProcessPriority() on the process creation callback fixes the issue (But only if we successfully create a process), but I assume we're not doing that by default for a reason.

Comment 9 by gab@chromium.org, Nov 22 2016

This is indeed intentional, see  https://crbug.com/560446#c32 .

But I'm still wondering why you're getting |is_process_backgrounded_ == true| early if UpdateProcessPriority() isn't called?

Comment 10 by gab@chromium.org, Nov 22 2016

Also I just tried running browser_tests.exe from a build like yours [1] on Windows and everything seems fine..?! 

[1]
   is_component_build = true
   is_debug = false
   is_chrome_branded = true
   dcheck_always_on = true
   is_win_fastlink = true
   enable_nacl = false

Comment 11 by gab@chromium.org, Nov 22 2016

One possibility:

The only place other than UpdateProcessPriority() where is_process_backgrounded_ is updated is in RenderProcessHostImpl::OnProcessLaunched:

    is_process_backgrounded_ =
        child_process_launcher_->GetProcess().IsProcessBackgrounded();

which means that if your browser_tests.exe process is running at background priority for whatever reason on your OS, then so will its child processes and this very call will detect itself as a background process.
Oh....That's probably it.  I run command prompt at reduced priority, so MSVC intellisense takes priority over building.
And I've confirmed that's exactly the issue I'm running into.

Comment 14 by gab@chromium.org, Nov 22 2016

Labels: -Pri-1 Pri-3
Owner: mmenke@chromium.org
Status: Assigned (was: Untriaged)
Summary: DCHECK triggering in RenderProcessHostImpl::WidgetHidden when running tests from a cmd prompt at lowered priority (was: DCHECK triggering in RenderProcessHostImpl::WidgetHidden)
Aaaah ;-). Then I guess back to you to decide whether you care to fix this or not (e.g. can |is_process_backgrounded_| be initialized another way than through the very process' priority).

This doesn't affect the product so P3.

Comment 15 by gab@chromium.org, Nov 22 2016

Blocking: -560446
The DCHECK is incorrect, given that way of setting whether a process is backgrounded or not.  Is there any compelling reason for that logic?  Since it's not correct, I'm inclined to just default to false, but maybe I'm missing something (In all 30 seconds I've thought about the issue).

Comment 17 by nick@chromium.org, Nov 22 2016

I see. Yes the current code simply doesn't anticipate that case. Now that we understand it, I think it should be possible to trigger this by add a browsertest that changes the the browser process priority before launching a child process.

IIRC polling the actual process state was something we decided to do to avoid having to write code that anticipates os-specific behavior (e.g. on android processes are expected to launch at low priority). One way to circumvent the DCHECK in this case, would be to go back to having |is_process_backgrounded_| reflect "the priority we wish this process would have, modulo outside interference."

I.e., on windows, we would effectively change this line:

is_process_backgrounded_ =
        child_process_launcher_->GetProcess().IsProcessBackgrounded();

to:

is_process_backgrounded_ = false;

and so forth, for other platforms.
Yea, that seems like the right fix to me.  I'll dig through the code a bit more before sending out a CL, out of paranoia.

Comment 19 by gab@chromium.org, Nov 22 2016

Assuming the process' initial priority introduces an implicit dependency on the process launching code (which is outside of this module) though, e.g. if Android changes its approach per  issue 601184  :-(.
Status: WontFix (was: Assigned)

Sign in to add a comment