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

Issue 23613007: Fix threading races on HRTFElevation::audioBusMap (Closed)

Created:
7 years, 3 months ago by haraken
Modified:
7 years, 3 months ago
CC:
blink-reviews, eae+blinkwatch, dglazkov+blink, jeez
Visibility:
Public.

Description

Fix threading races on HRTFElevation::audioBusMap According to the crash report (https://cluster-fuzz.appspot.com/testcase?key=6291334197411840), there is a threading race in HRTFElevation::getConcatenatedImpulseResponsesForSubject. static PassRefPtr<AudioBus> getConcatenatedImpulseResponsesForSubject(...) { typedef HashMap<String, RefPtr<AudioBus> > AudioBusMap; DEFINE_STATIC_LOCAL(AudioBusMap, audioBusMap, ()); RefPtr<AudioBus> bus; AudioBusMap::iterator iterator = audioBusMap.find(subjectName); // (A) if (iterator == audioBusMap.end()) { ...; audioBusMap.set(subjectName, bus); // (B) } } It's possible that: (1) Thread 1 executes (A) (2) Thread 2 executes (A) (3) Thread 1 executes (B) (4) Thread 2 executes (B) and crashes. This CL protects accesses to the AudioBusMap with mutex. BUG=270758 No tests because the crash depends on threading races and thus not reproducible. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=157273

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -0 lines) Patch
M Source/core/platform/audio/HRTFElevation.cpp View 1 2 3 2 chunks +3 lines, -0 lines 1 comment Download

Messages

Total messages: 12 (0 generated)
haraken
kbr: would you take a look at this one too? :)
7 years, 3 months ago (2013-09-04 00:49:07 UTC) #1
haraken
kbr: ping?
7 years, 3 months ago (2013-09-04 19:51:17 UTC) #2
Ken Russell (switch to Gerrit)
https://codereview.chromium.org/23613007/diff/7001/Source/core/platform/audio/HRTFElevation.cpp File Source/core/platform/audio/HRTFElevation.cpp (right): https://codereview.chromium.org/23613007/diff/7001/Source/core/platform/audio/HRTFElevation.cpp#newcode68 Source/core/platform/audio/HRTFElevation.cpp:68: DEFINE_STATIC_LOCAL(Mutex, mutex, ()); This doesn't look any safer to ...
7 years, 3 months ago (2013-09-04 19:57:55 UTC) #3
haraken
On 2013/09/04 19:57:55, Ken Russell wrote: > https://codereview.chromium.org/23613007/diff/7001/Source/core/platform/audio/HRTFElevation.cpp > File Source/core/platform/audio/HRTFElevation.cpp (right): > > https://codereview.chromium.org/23613007/diff/7001/Source/core/platform/audio/HRTFElevation.cpp#newcode68 ...
7 years, 3 months ago (2013-09-04 20:05:24 UTC) #4
Ken Russell (switch to Gerrit)
On 2013/09/04 20:05:24, haraken wrote: > On 2013/09/04 19:57:55, Ken Russell wrote: > > > ...
7 years, 3 months ago (2013-09-05 00:11:39 UTC) #5
haraken
> Looking elsewhere in the code base, it looks like defining a static local mutex ...
7 years, 3 months ago (2013-09-05 00:17:09 UTC) #6
Raymond Toy
On 2013/09/05 00:17:09, haraken wrote: > > Looking elsewhere in the code base, it looks ...
7 years, 3 months ago (2013-09-05 02:13:20 UTC) #7
haraken
Thanks for reviewing!
7 years, 3 months ago (2013-09-05 02:26:14 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/haraken@chromium.org/23613007/7001
7 years, 3 months ago (2013-09-05 02:26:20 UTC) #9
commit-bot: I haz the power
Change committed as 157273
7 years, 3 months ago (2013-09-05 04:59:21 UTC) #10
kcc1
>> No tests because the crash depends on threading races and thus not reproducible. We ...
7 years, 3 months ago (2013-09-05 06:43:50 UTC) #11
haraken
7 years, 3 months ago (2013-09-05 06:48:15 UTC) #12
Message was sent while issue was closed.
On 2013/09/05 06:43:50, kcc1 wrote:
> >> No tests because the crash depends on threading races and thus not
> reproducible.
> 
> We have ThreadSanitizer, a data race detector. 
> If you add a test that used to have a race, 
> our ThreadSanitizer bots would find races if they appear again.

The race happens just if the Audio thread calls
getConcatenatedImpulseResponsesForSubject(). I think it should be already
happening in some tests in webaudio/... Will take a look.

Powered by Google App Engine
This is Rietveld 408576698