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

Issue 1666863002: Fix race between Thread ctor/dtor and MessageQueueManager registrations. (Closed)

Created:
4 years, 10 months ago by joachim
Modified:
4 years, 10 months ago
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com
Base URL:
https://chromium.googlesource.com/external/webrtc.git@master
Target Ref:
refs/pending/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fix race between Thread ctor/dtor and MessageQueueManager registrations. This CL fixes a race where for Thread objects the parent MessageQueue constructor registers the object in the MessageQueueManager even though the Thread is not constructed completely yet. Same happens during destruction. BUG=webrtc:1225 Committed: https://crrev.com/25d1f28fa978f555d9a5a8855712db5a74d6828d Cr-Commit-Position: refs/heads/master@{#11497}

Patch Set 1 #

Total comments: 14

Patch Set 2 : Call "DoDestroy" from AutoThread/ComThread. #

Patch Set 3 : Added unittest. #

Total comments: 2

Patch Set 4 : Added comment. #

Total comments: 1

Patch Set 5 : Added comment to MessageQueue constructor. #

Total comments: 6

Patch Set 6 : Added DoInit for initialization #

Patch Set 7 : Update other Thread/MessageQueue classes. #

Patch Set 8 : Reverted PS #7, updated comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+98 lines, -11 lines) Patch
M webrtc/base/messagequeue.h View 1 2 3 4 5 6 7 3 chunks +22 lines, -1 line 0 comments Download
M webrtc/base/messagequeue.cc View 1 2 3 4 5 2 chunks +23 lines, -3 lines 0 comments Download
M webrtc/base/thread.h View 1 2 3 4 5 6 7 3 chunks +10 lines, -4 lines 0 comments Download
M webrtc/base/thread.cc View 1 2 3 4 5 6 7 2 chunks +6 lines, -3 lines 0 comments Download
M webrtc/base/thread_unittest.cc View 1 2 3 7 2 chunks +37 lines, -0 lines 0 comments Download

Messages

Total messages: 27 (4 generated)
joachim
Ptal. Do you have an idea how this could be tested?
4 years, 10 months ago (2016-02-03 22:38:42 UTC) #2
pthatcher1
https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/messagequeue.cc File webrtc/base/messagequeue.cc (right): https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/messagequeue.cc#newcode133 webrtc/base/messagequeue.cc:133: MessageQueueManager::Add(this); If ww want to call MessageQueueManager::Add before ss_->SetMessageQueue(this) ...
4 years, 10 months ago (2016-02-03 23:51:48 UTC) #3
joachim
I came up with an idea for a test that doesn't exactly trigger the race ...
4 years, 10 months ago (2016-02-03 23:51:55 UTC) #4
joachim
Sorry for updating changes while you were reviewing. Please see my answers to your comments. ...
4 years, 10 months ago (2016-02-04 00:01:20 UTC) #5
pthatcher1
I like the test idea. Looking forward to seeing the new comments. https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/thread.cc File webrtc/base/thread.cc ...
4 years, 10 months ago (2016-02-04 00:50:38 UTC) #6
joachim
https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/thread.cc File webrtc/base/thread.cc (left): https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/thread.cc#oldcode155 webrtc/base/thread.cc:155: Clear(NULL); On 2016/02/04 00:50:38, pthatcher1 wrote: > On 2016/02/04 ...
4 years, 10 months ago (2016-02-04 01:00:09 UTC) #7
pthatcher1
Taylor, can you also review this? I'd like another pair of eyes on it, given ...
4 years, 10 months ago (2016-02-04 03:14:11 UTC) #9
joachim
Added the comment. https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/thread.cc File webrtc/base/thread.cc (right): https://codereview.webrtc.org/1666863002/diff/1/webrtc/base/thread.cc#newcode156 webrtc/base/thread.cc:156: DoDestroy(); On 2016/02/04 03:14:11, pthatcher1 wrote: ...
4 years, 10 months ago (2016-02-04 08:35:56 UTC) #10
Taylor Brandstetter
A couple questions: Is there a reason why AutoThread and ComThread call DoDestroy, but not ...
4 years, 10 months ago (2016-02-04 19:16:38 UTC) #11
joachim
Thanks for your feedback. About not changing other Thread subclasses: I wanted to get some ...
4 years, 10 months ago (2016-02-04 20:22:31 UTC) #12
Taylor Brandstetter
Looks good, as long as the other Thread classes (including JingleThreadWrapper, in Chromium) are eventually ...
4 years, 10 months ago (2016-02-04 21:05:58 UTC) #13
joachim
I updated the other Thread/MessageQueue classes and changed some "virtual" to "override" on the way. ...
4 years, 10 months ago (2016-02-04 22:54:08 UTC) #14
Taylor Brandstetter
After thinking about this more: Do we really need to call DoInit()/DoDestroy() in *all* subclasses ...
4 years, 10 months ago (2016-02-04 23:51:02 UTC) #15
joachim
On 2016/02/04 23:51:02, Taylor Brandstetter wrote: > After thinking about this more: Do we really ...
4 years, 10 months ago (2016-02-05 00:10:12 UTC) #16
Taylor Brandstetter
On 2016/02/05 00:10:12, joachim wrote: > On 2016/02/04 23:51:02, Taylor Brandstetter wrote: > > After ...
4 years, 10 months ago (2016-02-05 00:22:36 UTC) #17
joachim
On 2016/02/05 00:22:36, Taylor Brandstetter wrote: > On 2016/02/05 00:10:12, joachim wrote: > > On ...
4 years, 10 months ago (2016-02-05 00:43:42 UTC) #18
Taylor Brandstetter
lgtm
4 years, 10 months ago (2016-02-05 02:12:42 UTC) #19
pthatcher1
On 2016/02/05 02:12:42, Taylor Brandstetter wrote: > lgtm lgtm Taylor, can you submit for him ...
4 years, 10 months ago (2016-02-05 02:16:27 UTC) #20
Taylor Brandstetter
On 2016/02/05 02:16:27, pthatcher1 wrote: > On 2016/02/05 02:12:42, Taylor Brandstetter wrote: > > lgtm ...
4 years, 10 months ago (2016-02-05 02:24:02 UTC) #21
joachim
On 2016/02/05 02:16:27, pthatcher1 wrote: > On 2016/02/05 02:12:42, Taylor Brandstetter wrote: > > lgtm ...
4 years, 10 months ago (2016-02-05 07:21:23 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1666863002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1666863002/140001
4 years, 10 months ago (2016-02-05 07:21:47 UTC) #24
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 10 months ago (2016-02-05 08:25:04 UTC) #25
commit-bot: I haz the power
4 years, 10 months ago (2016-02-05 08:25:14 UTC) #27
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/25d1f28fa978f555d9a5a8855712db5a74d6828d
Cr-Commit-Position: refs/heads/master@{#11497}

Powered by Google App Engine
This is Rietveld 408576698