DCHECK triggering in RenderProcessHostImpl::WidgetHidden when running tests from a cmd prompt at lowered priority |
|||||
Issue descriptionThere'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.
,
Nov 22 2016
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.
,
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?
,
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?
,
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.
,
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.
,
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.
,
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?
,
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
,
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.
,
Nov 22 2016
Oh....That's probably it. I run command prompt at reduced priority, so MSVC intellisense takes priority over building.
,
Nov 22 2016
And I've confirmed that's exactly the issue I'm running into.
,
Nov 22 2016
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.
,
Nov 22 2016
,
Nov 22 2016
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).
,
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.
,
Nov 22 2016
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.
,
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 :-(.
,
Oct 23
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by gab@chromium.org
, Nov 22 2016Cc: nick@chromium.org brucedaw...@chromium.org