Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Issue 9837053: Added code for renderer to cleanly exit. (Closed)

Created:
8 years, 9 months ago by asharif1
Modified:
8 years, 8 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, darin-cc_chromium.org, jam, bjanakiraman
Base URL:
http://git.chromium.org/chromium/src.git@master
Visibility:
Public.

Description

This is only executed when Chrome is built with -DRENDERER_CLEAN_EXIT. Before this CL, if you kill Chrome's main process, the renderer would not exit cleanly. Because of this, when running Chrome under Profile-Guided-Optimization mode, we would not get the profile for the renderer process. That results in only minor speed gains when using PGO (<5% improvement). When the profile of the renderer process is captured and fed back, we get up to 27% performance improvement in page cyclers on ChromeOS. TEST=Rebuilt Chrome with -DRENDERER_CLEAN_EXIT. Ran on ChromeOS. Attached gdb to the renderer. Set a breakpoint on exit(). Sent SIGTERM to parent Chrome process. Saw the breakpoint get hit. BUG=107584

Patch Set 1 #

Patch Set 2 : git try #

Total comments: 4

Patch Set 3 : Tested this patch on ChromeOS. Working. #

Patch Set 4 : Added a more descriptive message. #

Total comments: 15

Patch Set 5 : Addressed some comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+50 lines, -0 lines) Patch
M base/process_util.h View 1 2 3 4 2 chunks +9 lines, -0 lines 0 comments Download
M base/process_util.cc View 1 2 3 4 1 chunk +15 lines, -0 lines 0 comments Download
M chrome/renderer/chrome_render_process_observer.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M content/renderer/renderer_main.cc View 1 2 3 4 2 chunks +22 lines, -0 lines 0 comments Download

Messages

Total messages: 10 (0 generated)
asharif1
Thoughts on this patch?
8 years, 9 months ago (2012-03-23 19:21:15 UTC) #1
Evan Martin
markus or agl should review, here are my comments http://codereview.chromium.org/9837053/diff/3/content/renderer/renderer_main.cc File content/renderer/renderer_main.cc (right): http://codereview.chromium.org/9837053/diff/3/content/renderer/renderer_main.cc#newcode131 content/renderer/renderer_main.cc:131: ...
8 years, 9 months ago (2012-03-26 17:17:25 UTC) #2
agl
In additional to Evan's comments, the CL description needs to mention why we want this. ...
8 years, 9 months ago (2012-03-26 17:24:32 UTC) #3
asharif1
On 2012/03/26 17:24:32, agl wrote: > In additional to Evan's comments, the CL description needs ...
8 years, 9 months ago (2012-03-26 17:37:41 UTC) #4
asharif1
On 2012/03/26 17:37:41, asharif1 wrote: > On 2012/03/26 17:24:32, agl wrote: > > In additional ...
8 years, 9 months ago (2012-03-28 20:48:16 UTC) #5
Markus (顧孟勤)
I think, this still needs a little bit of work. And it probably also needs ...
8 years, 9 months ago (2012-03-28 23:07:56 UTC) #6
asharif1
http://codereview.chromium.org/9837053/diff/12003/chrome/renderer/chrome_render_process_observer.cc File chrome/renderer/chrome_render_process_observer.cc (right): http://codereview.chromium.org/9837053/diff/12003/chrome/renderer/chrome_render_process_observer.cc#newcode168 chrome/renderer/chrome_render_process_observer.cc:168: _exit(0); On 2012/03/28 23:07:56, Markus (顧孟勤) wrote: > _exit() ...
8 years, 9 months ago (2012-03-29 02:13:11 UTC) #7
Markus (顧孟勤)
On Wed, Mar 28, 2012 at 19:13, <asharif@chromium.org> wrote: > One thread receives enters this ...
8 years, 9 months ago (2012-03-29 04:48:07 UTC) #8
asharif1
Okay, a little background since we're going back and forth on this. ChromeOS wants to ...
8 years, 9 months ago (2012-03-29 05:09:49 UTC) #9
Markus (顧孟勤)
8 years, 9 months ago (2012-03-29 05:46:39 UTC) #10
We really need input from people who have looked at this code in more
detail (unfortunately, that probably means Evan). But here are some
suggestions that might get you started on how to do this properly.

In the vast majority of cases, the renderer will eventually return to the
main loop. So, if we are interested in running exit handlers (e.g. when
profiling), we should not call _exit() from the
SuicideOnChannelErrorFilter. If we just continue, we will hopefully shut
down properly in a couple of seconds.

Of course, there will be rare cases, when we are in fact hung and don't
exit properly. You can probably address this problem by calling something
like "alarm(30)" in the SuicideOnChannelErrorFilter. This will trigger a
SIGALRM after 30s, and I believe we keep the default behavior, which will
end up terminating the program.

Of course, you now need to double-check that the browser does in fact try
to shut down the renderer properly, instead of sending it a SIGTERM.

If it doesn't do that, we have to figure out how to fix that -- and again,
this might have to be code that is different between the normal case and
the code that runs when profiling.


Markus

Powered by Google App Engine
This is Rietveld 408576698