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

Issue 2876273002: Fixing race between ~AsyncInvoker and ~AsyncClosure. (Closed)

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

Description

Fixing race between ~AsyncInvoker and ~AsyncClosure. The AsyncInvoker destructor waits for all invoked tasks to be complete (in other words, all AsyncClosures to be destructed). They were using an event to wake up the destructor, but a race made it possible for this event to be dereferenced after it's destroyed. So, instead of using an event, this CL just busy-waits until the tasks are complete. The advantage of this approach is that the tasks themselves don't need to do any additional synchronization, which could harm performance since tasks are invoked much more often than AsyncInvokers are destroyed. BUG=webrtc:7656

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -11 lines) Patch
M webrtc/base/asyncinvoker.h View 1 chunk +0 lines, -1 line 0 comments Download
M webrtc/base/asyncinvoker.cc View 5 chunks +10 lines, -9 lines 3 comments Download
M webrtc/base/asyncinvoker-inl.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 10 (3 generated)
Taylor Brandstetter
Tommi or Karl, what do you think about this? I've tried to fix this twice ...
3 years, 7 months ago (2017-05-12 21:57:39 UTC) #2
kwiberg-webrtc
I won't try to review this, since I don't know these classes well enough. Although ...
3 years, 7 months ago (2017-05-15 08:44:48 UTC) #3
Taylor Brandstetter
nisse@, maybe you're more familiar with AsyncInvoker and have a suggestion? In summary: I'm trying ...
3 years, 7 months ago (2017-05-16 18:44:12 UTC) #5
nisse-webrtc
On 2017/05/16 18:44:12, Taylor Brandstetter wrote: > nisse@, maybe you're more familiar with AsyncInvoker and ...
3 years, 7 months ago (2017-05-17 07:29:11 UTC) #6
Taylor Brandstetter
The race occurs if one thread is in between these two lines while the AsyncInvoker ...
3 years, 7 months ago (2017-05-17 19:58:19 UTC) #7
nisse-webrtc
https://codereview.webrtc.org/2876273002/diff/1/webrtc/base/asyncinvoker.cc File webrtc/base/asyncinvoker.cc (right): https://codereview.webrtc.org/2876273002/diff/1/webrtc/base/asyncinvoker.cc#newcode29 webrtc/base/asyncinvoker.cc:29: rtc::Thread::Current()->SleepMs(0); I think it's better with some small but ...
3 years, 7 months ago (2017-05-19 07:17:00 UTC) #8
Taylor Brandstetter
3 years, 4 months ago (2017-08-04 00:09:33 UTC) #10
Message was sent while issue was closed.
Closing this in favor of https://codereview.webrtc.org/2885143005/

Powered by Google App Engine
This is Rietveld 408576698