You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TSan: VolumeMeter paintEvent reads level/ballistics data without dataMutex #131
Found by the TSan launch pass (meta issue linked as parent). Upstream OBS code, unchanged in this fork.
Race
WARNING: ThreadSanitizer: data race
Write of size 8 by thread T49 'threaded-ml' (audio capture, via volmeter callback):
#0 VolumeMeter::setLevels frontend/components/VolumeMeter.cpp:376 (currentLastUpdateTime, under dataMutex)
#3 signal_levels_updated libobs/obs-audio-controls.c:203
Previous read by main thread (no lock):
#0 VolumeMeter::detectIdle frontend/components/VolumeMeter.cpp:508
#1 VolumeMeter::paintEvent frontend/components/VolumeMeter.cpp:750
WARNING: ThreadSanitizer: data race
Write of size 4 by thread T49 (under dataMutex):
#0 VolumeMeter::calculateBallisticsForChannel frontend/components/VolumeMeter.cpp:556 (displayInputPeakHold)
#2 VolumeMeter::setLevels frontend/components/VolumeMeter.cpp:386
Previous read by main thread (no lock):
#0 VolumeMeter::paintEvent frontend/components/VolumeMeter.cpp:859
Cause
setLevels() runs on the audio capture thread and writes currentLastUpdateTime, current* and (through calculateBallistics) all display* arrays under dataMutex. paintEvent and detectIdle read them on the UI thread without the lock, and detectIdle → resetLevels() also writes them unlocked. The effects are torn meter values and a peak-hold indicator that flickers or resets wrongly.
Fix direction
Take dataMutex and copy a snapshot of the levels at the top of paintEvent, then draw from the copy. Do the idle check under the same lock.
Fixed by PR #442, merged as 5ba1b04. The UI now snapshots all four meter values under dataMutex, and the idle check/reset uses that same mutex. A Qt-free concurrency test was TSan RED before locking and GREEN after; lint, OFF/ON unit tests, and a full Linux Qt app build passed. No remaining work is known for the reported meter race.
Activity
zackees commentedon Oct 13, 2026
Claiming: VolumeMeter paint/audio data race.
zackees commentedon Oct 13, 2026
Fixed by PR #442, merged as 5ba1b04. The UI now snapshots all four meter values under dataMutex, and the idle check/reset uses that same mutex. A Qt-free concurrency test was TSan RED before locking and GREEN after; lint, OFF/ON unit tests, and a full Linux Qt app build passed. No remaining work is known for the reported meter race.