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

Issue 2890213002: Prevent data race in GetStaticInstance (Closed)

Created:
3 years, 7 months ago by cstanfill
Modified:
3 years, 6 months ago
CC:
webrtc-reviews_webrtc.org, zhengzhonghou_agora.io, tterriberry_mozilla.com, fengyue_agora.io, peah-webrtc, mflodman
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Prevent data race in GetStaticInstance The previous code attempted to lock instance_count and instance with a CriticalSection, but the CriticalSection was not static, so each function invocation got its own instance. Locking this call-specific instance doesn't actually stop any other threads from concurrently accessing the same function-scope globals, so this function had a data race, which broke tsan tests (and possibly other things). Making the CriticalSection shared among function calls will actually synchronize access to the globals and allow our tsan tests to pass. BUG=webrtc:3062 Review-Url: https://codereview.webrtc.org/2890213002 Cr-Commit-Position: refs/heads/master@{#18296} Committed: https://chromium.googlesource.com/external/webrtc/+/c66f8d7d6d3d39987927348818a1b6e50f786cf7

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M webrtc/system_wrappers/include/static_instance.h View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 20 (10 generated)
cstanfill
Hi magnus, I think I have a fix for a data race issue in some ...
3 years, 7 months ago (2017-05-18 16:57:25 UTC) #4
henrika_webrtc
Modified reviewers to owners in webrtc/system_wrappers.
3 years, 7 months ago (2017-05-19 07:32:26 UTC) #9
nisse-webrtc
lgtm
3 years, 7 months ago (2017-05-19 07:37:06 UTC) #10
cstanfill
friendly ping to kwiberg@, i think this needs your lgtm
3 years, 7 months ago (2017-05-23 13:09:09 UTC) #11
kwiberg-webrtc
lgtm However, since static locals are initialized in a thread-safe way since C++11, I guess ...
3 years, 7 months ago (2017-05-24 08:59:14 UTC) #12
cstanfill
On 2017/05/24 08:59:14, kwiberg-webrtc wrote: > lgtm > > However, since static locals are initialized ...
3 years, 7 months ago (2017-05-25 14:47:43 UTC) #13
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/2890213002/1
3 years, 6 months ago (2017-05-29 06:43:05 UTC) #15
nisse-webrtc
On 2017/05/25 14:47:43, cstanfill wrote: > On 2017/05/24 08:59:14, kwiberg-webrtc wrote: > > lgtm > ...
3 years, 6 months ago (2017-05-29 06:43:26 UTC) #16
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/external/webrtc/+/c66f8d7d6d3d39987927348818a1b6e50f786cf7
3 years, 6 months ago (2017-05-29 07:01:19 UTC) #19
cstanfill
3 years, 6 months ago (2017-05-30 13:39:22 UTC) #20
Message was sent while issue was closed.
Thank you!

Powered by Google App Engine
This is Rietveld 408576698