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

Issue 2885143006: Fixing potential AsyncInvoker deadlock that occurs for "reentrant" invocations. (Closed)

Created:
3 years, 7 months ago by Taylor Brandstetter
Modified:
3 years, 4 months ago
Reviewers:
nisse-webrtc
CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, kwiberg-webrtc
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Fixing potential AsyncInvoker deadlock that occurs for "reentrant" invocations. The deadlock occurs if the AsyncInvoker is destroyed on thread A while a task on thread B is running, which AsyncInvokes a task back on thread A. This was causing pending_invocations_ to end up negative, because an AsyncClosure that's never added to a thread's message queue (due to the "destroying_" flag) caused the count to be decremented but not incremented. BUG=None Review-Url: https://codereview.webrtc.org/2885143006 Cr-Commit-Position: refs/heads/master@{#18225} Committed: https://chromium.googlesource.com/external/webrtc/+/ef37ca5fb3431864130de3c2fd0ff865f9eb47dd

Patch Set 1 #

Total comments: 10

Patch Set 2 : Move "MessageQueueManager::Clear" back to where it was. Makes no difference. #

Patch Set 3 : Addressing TSan race warning #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -23 lines) Patch
M webrtc/base/asyncinvoker.h View 1 2 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/asyncinvoker.cc View 1 2 5 chunks +9 lines, -6 lines 0 comments Download
M webrtc/base/asyncinvoker-inl.h View 1 chunk +1 line, -1 line 0 comments Download
M webrtc/base/thread_unittest.cc View 4 chunks +40 lines, -15 lines 0 comments Download

Messages

Total messages: 21 (9 generated)
Taylor Brandstetter
3 years, 7 months ago (2017-05-17 21:13:03 UTC) #2
nisse-webrtc
https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc File webrtc/base/asyncinvoker.cc (right): https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc#newcode33 webrtc/base/asyncinvoker.cc:33: MessageQueueManager::Clear(this); This is subtle (maybe too subtle...). So at ...
3 years, 7 months ago (2017-05-18 08:04:55 UTC) #3
nisse-webrtc
https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc File webrtc/base/asyncinvoker.cc (right): https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc#newcode117 webrtc/base/asyncinvoker.cc:117: AtomicOps::Decrement(&invoker_->pending_invocations_); Thinking a bit more, I'm afraids this approach ...
3 years, 7 months ago (2017-05-18 11:12:39 UTC) #4
Taylor Brandstetter
https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc File webrtc/base/asyncinvoker.cc (right): https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc#newcode33 webrtc/base/asyncinvoker.cc:33: MessageQueueManager::Clear(this); I must have had a brain lapse and ...
3 years, 7 months ago (2017-05-18 20:54:52 UTC) #5
nisse-webrtc
https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc File webrtc/base/asyncinvoker.cc (right): https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc#newcode113 webrtc/base/asyncinvoker.cc:113: AtomicOps::Increment(&invoker_->pending_invocations_); On 2017/05/18 20:54:52, Taylor Brandstetter wrote: > On ...
3 years, 7 months ago (2017-05-19 06:43:21 UTC) #6
nisse-webrtc
https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc File webrtc/base/asyncinvoker.cc (right): https://codereview.webrtc.org/2885143006/diff/1/webrtc/base/asyncinvoker.cc#newcode117 webrtc/base/asyncinvoker.cc:117: AtomicOps::Decrement(&invoker_->pending_invocations_); On 2017/05/19 06:43:21, nisse-webrtc wrote: > On 2017/05/18 ...
3 years, 7 months ago (2017-05-19 06:48:17 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2885143006/20001
3 years, 7 months ago (2017-05-19 18:01:08 UTC) #10
commit-bot: I haz the power
Try jobs failed on following builders: linux_tsan2 on master.tryserver.webrtc (JOB_FAILED, http://build.chromium.org/p/tryserver.webrtc/builders/linux_tsan2/builds/22667)
3 years, 7 months ago (2017-05-19 18:45:20 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2885143006/40001
3 years, 7 months ago (2017-05-22 22:00:31 UTC) #15
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/external/webrtc/+/ef37ca5fb3431864130de3c2fd0ff865f9eb47dd
3 years, 7 months ago (2017-05-22 22:32:58 UTC) #18
Taylor Brandstetter
A revert of this CL (patchset #3 id:40001) has been created in https://codereview.webrtc.org/2904543003/ by deadbeef@webrtc.org. ...
3 years, 7 months ago (2017-05-23 19:54:53 UTC) #19
Taylor Brandstetter
3 years, 4 months ago (2017-08-04 00:09:01 UTC) #21
Message was sent while issue was closed.
This CL will be relanded as https://codereview.webrtc.org/2885143005/

Powered by Google App Engine
This is Rietveld 408576698