|
|
Created:
4 years, 6 months ago by andresp Modified:
4 years, 5 months ago CC:
webrtc-reviews_webrtc.org, tterriberry_mozilla.com, qiang.lu, niklas.enbom, yujie_mao (webrtc), peah-webrtc Base URL:
https://chromium.googlesource.com/external/webrtc.git@master Target Ref:
refs/pending/heads/master Project:
webrtc Visibility:
Public. |
DescriptionProtect MessageQueue stop field with a critical section to avoid data races.
Committed: https://crrev.com/1d35d2971b1e89b3ecadb7fb1ff064f9af850ad4
Cr-Commit-Position: refs/heads/master@{#13430}
Patch Set 1 #
Total comments: 3
Patch Set 2 : use atomics #Patch Set 3 : fix windows compile error. #Patch Set 4 : Clear suppresion is needed for vtable/destructor race #
Total comments: 2
Patch Set 5 : initialize with 0 #
Messages
Total messages: 35 (11 generated)
andresp@webrtc.org changed reviewers: + tommi@webrtc.org
On 2016/06/01 09:22:08, andresp wrote: > mailto:andresp@webrtc.org changed reviewers: > + mailto:tommi@webrtc.org The win_drmemory_light fail was probably unrelated. It was the "WinPing" test.
tommi@webrtc.org changed reviewers: + pthatcher@webrtc.org
swapping myself out for pthatcher (but you have my lgtm rubber stamp if you need it). Is there a bug report?
On 2016/06/01 12:41:57, tommi-webrtc wrote: > swapping myself out for pthatcher (but you have my lgtm rubber stamp if you need > it). > > Is there a bug report? Not that I know of. But I suspect I will be cleaning a few of the data races as when I run tsan in a project that uses webrtc I see these races and they clutter other races derived from a potentially incorrect use of webrtc.
On 2016/06/01 14:06:29, andresp wrote: > On 2016/06/01 12:41:57, tommi-webrtc wrote: > > swapping myself out for pthatcher (but you have my lgtm rubber stamp if you > need > > it). > > > > Is there a bug report? > > Not that I know of. But I suspect I will be cleaning a few of the data races as > when I run tsan in a project that uses webrtc I see these races and they clutter > other races derived from a potentially incorrect use of webrtc. It's great to fix these things. What I was thinking about is that when we do e.g. builds of Chrome or other products that use WebRTC, we look over the list of issues (bugs) that have been fixed in the period since the last release, and include in the release notes. I was wondering if this would be worth tracking that way.
pthatcher@webrtc.org changed reviewers: + deadbeef@webrtc.org
Taylor, can you also check this? Anything in MessageQueue could use multiple eyes. https://codereview.webrtc.org/2023193002/diff/1/webrtc/base/messagequeue.cc File webrtc/base/messagequeue.cc (right): https://codereview.webrtc.org/2023193002/diff/1/webrtc/base/messagequeue.cc#n... webrtc/base/messagequeue.cc:215: stop_ = true; Might as well rename "stop_" to "quitting_". https://codereview.webrtc.org/2023193002/diff/1/webrtc/base/messagequeue.cc#n... webrtc/base/messagequeue.cc:221: CritScope cs(&stop_crit_); Should we use an std::atomic here once they are allowed? Perhaps with a comment similar to the one in thread_unittest.cc above AtomicBool.
tommi@chromium.org changed reviewers: + tommi@chromium.org
https://codereview.webrtc.org/2023193002/diff/1/webrtc/base/messagequeue.cc File webrtc/base/messagequeue.cc (right): https://codereview.webrtc.org/2023193002/diff/1/webrtc/base/messagequeue.cc#n... webrtc/base/messagequeue.cc:221: CritScope cs(&stop_crit_); On 2016/06/01 15:29:14, pthatcher1 wrote: > Should we use an std::atomic here once they are allowed? Perhaps with a comment > similar to the one in thread_unittest.cc above AtomicBool. We do have alternatives to std::atomic that we can use instead. See webrtc/base/atomicops.h.
I don't see that this race causes any issues. Is this just fixing a TSan warning? If that's the case, is there a way to fix this without adding a critical section acquisition in the thread's event loop?
On 2016/06/01 17:00:38, Taylor Brandstetter wrote: > I don't see that this race causes any issues. Is this just fixing a TSan > warning? If that's the case, is there a way to fix this without adding a > critical section acquisition in the thread's event loop? Using atomics is one way
On 2016/06/01 17:03:14, tommi-webrtc wrote: > On 2016/06/01 17:00:38, Taylor Brandstetter wrote: > > I don't see that this race causes any issues. Is this just fixing a TSan > > warning? If that's the case, is there a way to fix this without adding a > > critical section acquisition in the thread's event loop? > > Using atomics is one way Other project attempted to suppress ::Clear as well, is this CL addressing that as well? (If so remove tsan suppression). If this is just to protect a bool then rtc::AtomicOps::ReleaseStore/AcquireLoad on a volatile int that's 1 or 0.
On 2016/06/17 20:08:59, pbos-webrtc wrote: > On 2016/06/01 17:03:14, tommi-webrtc wrote: > > On 2016/06/01 17:00:38, Taylor Brandstetter wrote: > > > I don't see that this race causes any issues. Is this just fixing a TSan > > > warning? If that's the case, is there a way to fix this without adding a > > > critical section acquisition in the thread's event loop? > > > > Using atomics is one way > > Other project attempted to suppress ::Clear as well, is this CL addressing that > as well? (If so remove tsan suppression). > > If this is just to protect a bool then rtc::AtomicOps::ReleaseStore/AcquireLoad > on a volatile int that's 1 or 0. https://chromium.googlesource.com/external/webrtc/+/f03a8d4c4dabcc18b36bce6b0... does this for shutdown synchronization.
On 2016/06/17 20:10:00, pbos-webrtc wrote: > On 2016/06/17 20:08:59, pbos-webrtc wrote: > > On 2016/06/01 17:03:14, tommi-webrtc wrote: > > > On 2016/06/01 17:00:38, Taylor Brandstetter wrote: > > > > I don't see that this race causes any issues. Is this just fixing a TSan > > > > warning? If that's the case, is there a way to fix this without adding a > > > > critical section acquisition in the thread's event loop? > > > > > > Using atomics is one way > > > > Other project attempted to suppress ::Clear as well, is this CL addressing > that > > as well? (If so remove tsan suppression). > > > > If this is just to protect a bool then > rtc::AtomicOps::ReleaseStore/AcquireLoad > > on a volatile int that's 1 or 0. > > https://chromium.googlesource.com/external/webrtc/+/f03a8d4c4dabcc18b36bce6b0... > does this for shutdown synchronization. I think it would be a good idea to do the same thing here. At least until we can use std::atomic (currently banned for Chromium).
On 2016/06/17 20:10:00, pbos-webrtc wrote: > On 2016/06/17 20:08:59, pbos-webrtc wrote: > > On 2016/06/01 17:03:14, tommi-webrtc wrote: > > > On 2016/06/01 17:00:38, Taylor Brandstetter wrote: > > > > I don't see that this race causes any issues. Is this just fixing a TSan > > > > warning? If that's the case, is there a way to fix this without adding a > > > > critical section acquisition in the thread's event loop? > > > > > > Using atomics is one way > > > > Other project attempted to suppress ::Clear as well, is this CL addressing > that > > as well? (If so remove tsan suppression). > > > > If this is just to protect a bool then > rtc::AtomicOps::ReleaseStore/AcquireLoad > > on a volatile int that's 1 or 0. > > https://chromium.googlesource.com/external/webrtc/+/f03a8d4c4dabcc18b36bce6b0... > does this for shutdown synchronization. I think it would be a good idea to do the same thing here. At least until we can use std::atomic (currently banned for Chromium).
Fixed according to comments. It is now using AtomicOps::Acquire/Release and it removes more race suppressions. Btw I still think the previous version with locks was acceptable and it is more in line with internal google recomendations.
On 2016/07/01 13:53:15, andresp wrote: > Fixed according to comments. It is now using AtomicOps::Acquire/Release and it > removes more race suppressions. > > Btw I still think the previous version with locks was acceptable and it is more > in line with internal google recomendations. Actually I had to keep the Clear suppressions in place as there is a vtable/destructor race which was too much to fix on this go.
lgtm with minor nit https://codereview.webrtc.org/2023193002/diff/60001/webrtc/base/messagequeue.cc File webrtc/base/messagequeue.cc (right): https://codereview.webrtc.org/2023193002/diff/60001/webrtc/base/messagequeue.... webrtc/base/messagequeue.cc:148: stop_(false), Since it's an int now, should probably initialize with 0 instead of false.
https://codereview.webrtc.org/2023193002/diff/60001/webrtc/base/messagequeue.cc File webrtc/base/messagequeue.cc (right): https://codereview.webrtc.org/2023193002/diff/60001/webrtc/base/messagequeue.... webrtc/base/messagequeue.cc:148: stop_(false), On 2016/07/07 22:01:47, Taylor Brandstetter wrote: > Since it's an int now, should probably initialize with 0 instead of false. Done.
The CQ bit was checked by andresp@webrtc.org
The patchset sent to the CQ was uploaded after l-g-t-m from tommi@webrtc.org, deadbeef@webrtc.org Link to the patchset: https://codereview.webrtc.org/2023193002/#ps80001 (title: "initialize with 0")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_arm64_rel on master.tryserver.webrtc (JOB_TIMED_OUT, no build URL) android_dbg on master.tryserver.webrtc (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by andresp@webrtc.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: android_dbg on master.tryserver.webrtc (JOB_TIMED_OUT, no build URL)
The CQ bit was checked by andresp@webrtc.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/...
Message was sent while issue was closed.
Committed patchset #5 (id:80001)
Message was sent while issue was closed.
Description was changed from ========== Protect MessageQueue stop field with a critical section to avoid data races. ========== to ========== Protect MessageQueue stop field with a critical section to avoid data races. Committed: https://crrev.com/1d35d2971b1e89b3ecadb7fb1ff064f9af850ad4 Cr-Commit-Position: refs/heads/master@{#13430} ==========
Message was sent while issue was closed.
Patchset 5 (id:??) landed as https://crrev.com/1d35d2971b1e89b3ecadb7fb1ff064f9af850ad4 Cr-Commit-Position: refs/heads/master@{#13430}
Message was sent while issue was closed.
A revert of this CL (patchset #5 id:80001) has been created in https://codereview.webrtc.org/2135173002/ by henrika@webrtc.org. The reason for reverting is: Only reasonable CL in blameslist for broken Chrome FYI bots on all platforms. See https://build.chromium.org/p/chromium.webrtc.fyi/waterfall?builder=Mac%20Builder. |