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

Issue 583043005: Pending tasks in a message loop should be deleted before shutting down Blink (Closed)

Created:
6 years, 3 months ago by haraken
Modified:
6 years, 1 month ago
CC:
chromium-reviews, mkwst+moarreviews-renderer_chromium.org, jam, erikwright+watch_chromium.org, sadrul, darin-cc_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Pending tasks in a message loop should be deleted before shutting down Blink Currently Blink is shut down before all the pending tasks in the message loop are deleted. This is problematic in Oilpan because a destructor of the pending tasks can touch Oilpan objects. Because Oilpan is already detached from the renderer thread at that point, touching Oilpan objects in the destructor leads to a crash. (See the bug report for a concrete scenario.) To prevent Blink objects from getting accessed after Blink is shut down, this CL deletes all pending tasks in a message loop before shutting down Blink. BUG=411026 TEST=None. I cannot reproduce the crash. Committed: https://crrev.com/fdd5612c20f777e1279efd7c1e99d82ed04afaaf Cr-Commit-Position: refs/heads/master@{#296697} Committed: https://crrev.com/16d32a9f7f6d1ebb639cacedb5156272a9fec764 Cr-Commit-Position: refs/heads/master@{#297338} Committed: https://crrev.com/53f081de05b86f73eca4e383a16c8dc723b78a99 Cr-Commit-Position: refs/heads/master@{#303557}

Patch Set 1 #

Total comments: 3

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 1

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Total comments: 2

Patch Set 9 : #

Patch Set 10 : #

Total comments: 1

Patch Set 11 : #

Patch Set 12 : #

Patch Set 13 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+44 lines, -13 lines) Patch
M content/common/gpu/client/gpu_channel_host.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M content/common/gpu/client/gpu_channel_host.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +8 lines, -4 lines 0 comments Download
M content/renderer/render_thread_impl.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +7 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +20 lines, -4 lines 0 comments Download
M content/renderer/renderer_main.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +6 lines, -5 lines 0 comments Download

Messages

Total messages: 64 (8 generated)
haraken
PTAL
6 years, 3 months ago (2014-09-22 02:26:23 UTC) #2
Mads Ager (chromium)
LGTM Oilpan exposes this issue but it seems bad in general that task destructors can ...
6 years, 3 months ago (2014-09-22 06:35:22 UTC) #3
haraken
jochen@: would you take a look at this when you have a cycle?
6 years, 3 months ago (2014-09-22 06:39:09 UTC) #4
jochen (gone - plz use gerrit)
i'm not sure this is the right approach. which tasks are touching oilpan objects? Can ...
6 years, 3 months ago (2014-09-22 06:44:45 UTC) #5
Mads Ager (chromium)
On 2014/09/22 at 06:44:45, jochen wrote: > i'm not sure this is the right approach. ...
6 years, 3 months ago (2014-09-22 06:59:09 UTC) #6
haraken
> i'm not sure this is the right approach. > > which tasks are touching ...
6 years, 3 months ago (2014-09-22 07:11:40 UTC) #7
haraken
+jar (but it looks like jar@ is OOO for a while)
6 years, 3 months ago (2014-09-22 07:12:13 UTC) #9
jamesr
Can we just quit the message loop completely before deinitializing Blink? What tasks in the ...
6 years, 3 months ago (2014-09-22 14:34:47 UTC) #10
jamesr
https://codereview.chromium.org/583043005/diff/1/base/message_loop/message_loop.h File base/message_loop/message_loop.h (right): https://codereview.chromium.org/583043005/diff/1/base/message_loop/message_loop.h#newcode377 base/message_loop/message_loop.h:377: bool DeletePendingTasks(); this doesn't make sense. ~MessageLoop() does the ...
6 years, 3 months ago (2014-09-22 14:38:04 UTC) #11
haraken
Thanks James for review! https://codereview.chromium.org/583043005/diff/1/content/renderer/renderer_main.cc File content/renderer/renderer_main.cc (right): https://codereview.chromium.org/583043005/diff/1/content/renderer/renderer_main.cc#newcode238 content/renderer/renderer_main.cc:238: main_message_loop.DeletePendingTasks(); On 2014/09/22 14:38:04, jamesr ...
6 years, 3 months ago (2014-09-22 15:54:18 UTC) #12
jamesr
On 2014/09/22 15:54:18, haraken wrote: > Thanks James for review! > > https://codereview.chromium.org/583043005/diff/1/content/renderer/renderer_main.cc > File ...
6 years, 3 months ago (2014-09-22 16:40:33 UTC) #13
haraken
On 2014/09/22 16:40:33, jamesr wrote: > On 2014/09/22 15:54:18, haraken wrote: > > Thanks James ...
6 years, 3 months ago (2014-09-24 01:24:04 UTC) #14
haraken
On 2014/09/24 01:24:04, haraken wrote: > On 2014/09/22 16:40:33, jamesr wrote: > > On 2014/09/22 ...
6 years, 3 months ago (2014-09-24 02:09:40 UTC) #15
jamesr
On 2014/09/24 02:09:40, haraken wrote: > On 2014/09/24 01:24:04, haraken wrote: > > On 2014/09/22 ...
6 years, 3 months ago (2014-09-24 02:47:09 UTC) #16
jamesr
The blink shutdown call is here: https://code.google.com/p/chromium/codesearch#chromium/src/content/renderer/render_thread_impl.cc&q=didExitModalLoop&sq=package:chromium&type=cs&l=591 which is after the code you posted that ...
6 years, 3 months ago (2014-09-24 02:49:23 UTC) #17
haraken
On 2014/09/24 02:47:09, jamesr wrote: > On 2014/09/24 02:09:40, haraken wrote: > > On 2014/09/24 ...
6 years, 3 months ago (2014-09-24 02:51:16 UTC) #18
jamesr
On 2014/09/24 02:51:16, haraken wrote: > It will work in practice because the task is ...
6 years, 3 months ago (2014-09-24 02:53:22 UTC) #19
jamesr
On 2014/09/24 01:24:04, haraken wrote: > On 2014/09/22 16:40:33, jamesr wrote: > > On 2014/09/22 ...
6 years, 3 months ago (2014-09-24 02:56:25 UTC) #20
jar (doing other things)
I'm not sure I'm fully following your proposal... but in general, it would be better ...
6 years, 3 months ago (2014-09-24 03:16:28 UTC) #21
jamesr
Looking more closely you need to shut the loop down at a specific point in ...
6 years, 3 months ago (2014-09-24 03:40:09 UTC) #22
haraken
On 2014/09/24 03:40:09, jamesr wrote: > Looking more closely you need to shut the loop ...
6 years, 3 months ago (2014-09-24 03:52:07 UTC) #23
jamesr
Worth a try!
6 years, 3 months ago (2014-09-24 04:18:22 UTC) #24
haraken
I tried to completely shut down (i.e., destruct) the message loop just before RenderThreadImpl::Shutdown() calls ...
6 years, 3 months ago (2014-09-24 04:53:29 UTC) #25
haraken
On 2014/09/24 04:53:29, haraken wrote: > I tried to completely shut down (i.e., destruct) the ...
6 years, 3 months ago (2014-09-24 04:53:42 UTC) #26
jamesr
This is still risky because if blink::shutdown() calls any code that creates a task or ...
6 years, 3 months ago (2014-09-24 04:57:26 UTC) #27
haraken
On 2014/09/24 04:57:26, jamesr wrote: > This is still risky because if blink::shutdown() calls any ...
6 years, 3 months ago (2014-09-24 05:40:51 UTC) #28
jamesr
Adding MessageLoop::Shutdown() introduces a new awkward state for base::MessageLoop where it's still around but is ...
6 years, 3 months ago (2014-09-24 05:46:10 UTC) #29
haraken
On 2014/09/24 05:46:10, jamesr wrote: > Adding MessageLoop::Shutdown() introduces a new awkward state for > ...
6 years, 3 months ago (2014-09-24 07:24:43 UTC) #30
haraken
jamesr@: friendly ping :)
6 years, 2 months ago (2014-09-25 00:41:52 UTC) #31
jamesr
The lack of trybots makes me nervous, but the code change lgtm as far as ...
6 years, 2 months ago (2014-09-25 06:03:21 UTC) #32
haraken
On 2014/09/25 06:03:21, jamesr wrote: > The lack of trybots makes me nervous, but the ...
6 years, 2 months ago (2014-09-25 06:24:53 UTC) #33
haraken
On 2014/09/25 06:24:53, haraken wrote: > On 2014/09/25 06:03:21, jamesr wrote: > > The lack ...
6 years, 2 months ago (2014-09-25 11:26:59 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/583043005/120001
6 years, 2 months ago (2014-09-25 11:28:58 UTC) #36
commit-bot: I haz the power
Committed patchset #7 (id:120001) as 1fb8091790b5065fa77956fbdc2f5ce5b539494b
6 years, 2 months ago (2014-09-25 12:24:37 UTC) #37
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/fdd5612c20f777e1279efd7c1e99d82ed04afaaf Cr-Commit-Position: refs/heads/master@{#296697}
6 years, 2 months ago (2014-09-25 12:25:11 UTC) #38
reveman
A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/608043002/ by reveman@chromium.org. ...
6 years, 2 months ago (2014-09-26 20:24:59 UTC) #39
Zhenyao Mo
On 2014/09/26 20:24:59, reveman wrote: > A revert of this CL (patchset #7 id:120001) has ...
6 years, 2 months ago (2014-09-26 20:58:19 UTC) #40
haraken
jamesr@: PTAL again. The previous patch caused crashes in ASAN bots because GpuChannelHost is destructed ...
6 years, 2 months ago (2014-09-29 05:24:45 UTC) #41
jamesr
https://codereview.chromium.org/583043005/diff/140001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/583043005/diff/140001/content/renderer/render_thread_impl.cc#newcode681 content/renderer/render_thread_impl.cc:681: NPChannelBase::CleanupChannels(); could this cause problems? it appears to call ...
6 years, 2 months ago (2014-09-29 19:03:56 UTC) #42
haraken
jamesr@: Thanks for review. PTAL. https://codereview.chromium.org/583043005/diff/140001/content/renderer/render_thread_impl.cc File content/renderer/render_thread_impl.cc (right): https://codereview.chromium.org/583043005/diff/140001/content/renderer/render_thread_impl.cc#newcode681 content/renderer/render_thread_impl.cc:681: NPChannelBase::CleanupChannels(); On 2014/09/29 19:03:56, ...
6 years, 2 months ago (2014-09-30 01:08:19 UTC) #43
jamesr
OK. I wasn't totally sure about that either, but this seems safer
6 years, 2 months ago (2014-09-30 01:09:54 UTC) #44
haraken
On 2014/09/30 01:09:54, jamesr wrote: > OK. I wasn't totally sure about that either, but ...
6 years, 2 months ago (2014-09-30 01:10:28 UTC) #45
jamesr
lgtm
6 years, 2 months ago (2014-09-30 01:10:30 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/583043005/160001
6 years, 2 months ago (2014-09-30 01:11:36 UTC) #48
commit-bot: I haz the power
Committed patchset #9 (id:160001) as de8c98a7bfd02b8022da6577d3e4112b15c34ba2
6 years, 2 months ago (2014-09-30 01:56:20 UTC) #49
commit-bot: I haz the power
Patchset 9 (id:??) landed as https://crrev.com/16d32a9f7f6d1ebb639cacedb5156272a9fec764 Cr-Commit-Position: refs/heads/master@{#297338}
6 years, 2 months ago (2014-09-30 01:56:50 UTC) #50
kareng
A revert of this CL (patchset #9 id:160001) has been created in https://codereview.chromium.org/614233002/ by kareng@google.com. ...
6 years, 2 months ago (2014-09-30 21:33:05 UTC) #51
haraken
jamesr@: Please take another look. kareng@: Sorry about the repeated breakage. Actually it's hard to ...
6 years, 2 months ago (2014-10-03 04:28:13 UTC) #52
haraken
Let me reland this CL.
6 years, 1 month ago (2014-11-10 07:41:03 UTC) #53
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/583043005/240001
6 years, 1 month ago (2014-11-10 07:41:48 UTC) #55
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/23151)
6 years, 1 month ago (2014-11-10 07:45:04 UTC) #57
haraken
kbr@: Would you take a look at the change in content/common/gpu/ ?
6 years, 1 month ago (2014-11-10 08:02:18 UTC) #59
Ken Russell (switch to Gerrit)
content/common/gpu changes LGTM.
6 years, 1 month ago (2014-11-10 19:16:57 UTC) #60
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/583043005/240001
6 years, 1 month ago (2014-11-11 01:01:11 UTC) #62
commit-bot: I haz the power
Committed patchset #13 (id:240001)
6 years, 1 month ago (2014-11-11 01:04:09 UTC) #63
commit-bot: I haz the power
6 years, 1 month ago (2014-11-11 01:04:41 UTC) #64
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/53f081de05b86f73eca4e383a16c8dc723b78a99
Cr-Commit-Position: refs/heads/master@{#303557}

Powered by Google App Engine
This is Rietveld 408576698