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

Issue 1748183006: Add lock to fix race in AudioRendererMixerInput. (Closed)

Created:
4 years, 9 months ago by chcunningham
Modified:
4 years, 9 months ago
Reviewers:
DaleCurtis, o1ka
CC:
chromium-reviews, feature-media-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add lock to fix race in AudioRendererMixerInput. Clusterfuzz identified a race between the media thread calling SetVolume and the audio device thread calling ProvideInput. Add a lock to synchronize access to |volume_| between threads. Also adds some thread_checkers to just firm up the contract that the majority of these methods are called only by the media thread. BUG=588992 Committed: https://crrev.com/57c6958a99f2c62a4408d2a9d262a22129309106 Cr-Commit-Position: refs/heads/master@{#379349} Committed: https://crrev.com/1675282361cc4dfa9e25beaabeb8c2e104140713 Cr-Commit-Position: refs/heads/master@{#381763}

Patch Set 1 #

Total comments: 4

Patch Set 2 : Add threadchecker, restrict lock to protecting |volume_| #

Patch Set 3 : Rebase #

Total comments: 4

Patch Set 4 : Remove destructor thread_check #

Patch Set 5 : Moving lock down in ProvideInput #

Total comments: 3

Patch Set 6 : Remove thread checker. #

Patch Set 7 : Typo. #

Total comments: 2

Patch Set 8 : Better thread safety comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+26 lines, -1 line) Patch
M media/base/audio_renderer_mixer_input.h View 1 2 3 4 5 6 7 3 chunks +16 lines, -0 lines 0 comments Download
M media/base/audio_renderer_mixer_input.cc View 1 2 3 4 5 6 7 3 chunks +10 lines, -1 line 0 comments Download

Messages

Total messages: 50 (15 generated)
chcunningham
I was not able to repro the race with minimized test case from the bug, ...
4 years, 9 months ago (2016-03-03 01:47:02 UTC) #2
DaleCurtis
I don't think you need all this locking. You only need the lock around the ...
4 years, 9 months ago (2016-03-03 02:01:22 UTC) #4
chcunningham1
On 2016/03/03 02:01:22, DaleCurtis wrote: > I don't think you need all this locking. You ...
4 years, 9 months ago (2016-03-03 02:31:42 UTC) #5
o1ka
Agree with Dale: those lock not only not needed, but also pretty dangerous. https://codereview.chromium.org/1748183006/diff/1/media/base/audio_renderer_mixer_input.cc File ...
4 years, 9 months ago (2016-03-03 11:04:02 UTC) #6
o1ka
On 2016/03/03 02:31:42, chcunningham1 wrote: > On 2016/03/03 02:01:22, DaleCurtis wrote: > > I don't ...
4 years, 9 months ago (2016-03-03 11:23:14 UTC) #7
o1ka
> In general, I don't think we should not add In general, I don't think ...
4 years, 9 months ago (2016-03-03 11:25:15 UTC) #8
chcunningham
> Good point. If we assume that all the MixerInput control operations run on the ...
4 years, 9 months ago (2016-03-03 18:40:05 UTC) #9
chcunningham
https://codereview.chromium.org/1748183006/diff/1/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/1/media/base/audio_renderer_mixer_input.cc#newcode220 media/base/audio_renderer_mixer_input.cc:220: base::AutoLock auto_lock(lock_); On 2016/03/03 11:04:02, o1ka wrote: > ProvideInput ...
4 years, 9 months ago (2016-03-03 18:40:20 UTC) #10
chcunningham1
Cast bot is failing in a media browser test. Seems the object is not destructed ...
4 years, 9 months ago (2016-03-03 21:12:56 UTC) #12
chcunningham
Destruction seems safe. Happens on main thread as part of WMPI teardown. WIMPI waits for ...
4 years, 9 months ago (2016-03-03 22:08:03 UTC) #13
DaleCurtis
https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc#newcode201 media/base/audio_renderer_mixer_input.cc:201: // No thread checker here. This method is called ...
4 years, 9 months ago (2016-03-03 22:14:15 UTC) #14
chcunningham
On 2016/03/03 22:08:03, chcunningham wrote: > Destruction seems safe. Happens on main thread as part ...
4 years, 9 months ago (2016-03-03 22:18:26 UTC) #15
chcunningham
https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc#newcode201 media/base/audio_renderer_mixer_input.cc:201: // No thread checker here. This method is called ...
4 years, 9 months ago (2016-03-03 22:21:58 UTC) #16
DaleCurtis
https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc#newcode201 media/base/audio_renderer_mixer_input.cc:201: // No thread checker here. This method is called ...
4 years, 9 months ago (2016-03-03 22:23:37 UTC) #17
chcunningham
https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/40001/media/base/audio_renderer_mixer_input.cc#newcode201 media/base/audio_renderer_mixer_input.cc:201: // No thread checker here. This method is called ...
4 years, 9 months ago (2016-03-03 23:06:15 UTC) #18
DaleCurtis
lgtm https://codereview.chromium.org/1748183006/diff/80001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/80001/media/base/audio_renderer_mixer_input.cc#newcode221 media/base/audio_renderer_mixer_input.cc:221: { {} are unnecessary since you're right above ...
4 years, 9 months ago (2016-03-03 23:08:02 UTC) #19
chcunningham1
https://codereview.chromium.org/1748183006/diff/80001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/80001/media/base/audio_renderer_mixer_input.cc#newcode221 media/base/audio_renderer_mixer_input.cc:221: { On 2016/03/03 23:08:01, DaleCurtis wrote: > {} are ...
4 years, 9 months ago (2016-03-03 23:18:54 UTC) #20
DaleCurtis
https://codereview.chromium.org/1748183006/diff/80001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/80001/media/base/audio_renderer_mixer_input.cc#newcode221 media/base/audio_renderer_mixer_input.cc:221: { On 2016/03/03 at 23:18:53, chcunningham1 wrote: > On ...
4 years, 9 months ago (2016-03-03 23:26:42 UTC) #21
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1748183006/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1748183006/80001
4 years, 9 months ago (2016-03-04 05:08:21 UTC) #25
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 9 months ago (2016-03-04 05:14:21 UTC) #27
o1ka
> > On the other hand, if control operations can be called from different threads, ...
4 years, 9 months ago (2016-03-04 09:54:09 UTC) #28
o1ka
Thanks a lot for fixing that!
4 years, 9 months ago (2016-03-04 09:55:04 UTC) #29
chcunningham
On 2016/03/04 09:55:04, o1ka wrote: > Thanks a lot for fixing that! Happy to fix ...
4 years, 9 months ago (2016-03-04 20:36:20 UTC) #30
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1748183006/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1748183006/80001
4 years, 9 months ago (2016-03-04 20:37:00 UTC) #32
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 9 months ago (2016-03-04 20:54:04 UTC) #34
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/57c6958a99f2c62a4408d2a9d262a22129309106 Cr-Commit-Position: refs/heads/master@{#379349}
4 years, 9 months ago (2016-03-04 20:56:12 UTC) #36
chcunningham
A revert of this CL (patchset #5 id:80001) has been created in https://codereview.chromium.org/1771463002/ by chcunningham@chromium.org. ...
4 years, 9 months ago (2016-03-04 23:21:02 UTC) #37
chcunningham
Turns out we can't use a thread checker because these methods are accessed by both ...
4 years, 9 months ago (2016-03-15 21:24:25 UTC) #39
chcunningham
linux_blink_rel_ng bot is happy this time. Reviewers, please take one last look.
4 years, 9 months ago (2016-03-15 22:13:23 UTC) #40
DaleCurtis
lgtm
4 years, 9 months ago (2016-03-15 22:33:58 UTC) #41
o1ka
Thanks for dealing with this! lgtm after comment cleanup. https://codereview.chromium.org/1748183006/diff/120001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/120001/media/base/audio_renderer_mixer_input.cc#newcode199 media/base/audio_renderer_mixer_input.cc:199: ...
4 years, 9 months ago (2016-03-16 14:31:18 UTC) #42
chcunningham
https://codereview.chromium.org/1748183006/diff/120001/media/base/audio_renderer_mixer_input.cc File media/base/audio_renderer_mixer_input.cc (right): https://codereview.chromium.org/1748183006/diff/120001/media/base/audio_renderer_mixer_input.cc#newcode199 media/base/audio_renderer_mixer_input.cc:199: // should be enforced by the caller. See the ...
4 years, 9 months ago (2016-03-17 17:59:45 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1748183006/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1748183006/140001
4 years, 9 months ago (2016-03-17 18:00:21 UTC) #46
commit-bot: I haz the power
Committed patchset #8 (id:140001)
4 years, 9 months ago (2016-03-17 18:58:10 UTC) #48
commit-bot: I haz the power
4 years, 9 months ago (2016-03-17 18:59:58 UTC) #50
Message was sent while issue was closed.
Patchset 8 (id:??) landed as
https://crrev.com/1675282361cc4dfa9e25beaabeb8c2e104140713
Cr-Commit-Position: refs/heads/master@{#381763}

Powered by Google App Engine
This is Rietveld 408576698