Skip to content

fix: snapshot VolumeMeter levels under dataMutex - #442

Merged
zackees merged 2 commits into
masterfrom
fix/131-volume-meter-race
Oct 13, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/131-volume-meter-race

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Fixes #131.

VolumeMeter::paintEvent now copies all four channel values under dataMutex once and draws from that snapshot. The idle timestamp check and its reset callback also run under the same mutex used by the audio callback. This removes the two TSan races without holding the lock while painting.

RED: 64b093d80 added a Qt-free concurrent test against unlocked snapshot and idle helpers. Running it with c++ -std=c++17 -O1 -g -fsanitize=thread reported races in both helpers and exited nonzero.

GREEN: c6846834c uses the locked helpers in the frontend. The targeted TSan test exits 0. ./lint, ./unittest (143 C tests with Rust OFF and ON), and the stamped local gate passed. Exported symbol sets remained identical (1766). Head: 2e8f35a8f29e.

Local-Gate: v1 tree=9bf4a2498f0ab005bd1919bf921447846239031a secs=155 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791861901,"gate":"rust/all/fmt","host":"linux-x86_64","key":"92c8f4dea282bfbba9c823a9b20e840a7b7332b3852ae6295a4b3317b9fab874","lane":"lint","parents":["64b093d808d49a4afe332985701613d56e3bbda7"],"secs":60,"stamp":"0dc2d711187888a5e23626f003d9412a","tree":"9bf4a2498f0ab005bd1919bf921447846239031a","v":1,"via":"run"}
Ci-Attestation: {"at":1791861901,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"92c8f4dea282bfbba9c823a9b20e840a7b7332b3852ae6295a4b3317b9fab874","lane":"lint","parents":["64b093d808d49a4afe332985701613d56e3bbda7"],"secs":60,"stamp":"63922fe92f0266ba54041f87e23610ca","tree":"9bf4a2498f0ab005bd1919bf921447846239031a","v":1,"via":"run"}
Ci-Attestation: {"at":1791861901,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"5969dde7e87dc8466affd5d3088078ec036a6b0889e9e3b8b2c33d8dd6d7f83a","lane":"rust-test","parents":["64b093d808d49a4afe332985701613d56e3bbda7"],"secs":42,"stamp":"5fdc8b766e599f1e20cdecd4981625da","tree":"9bf4a2498f0ab005bd1919bf921447846239031a","v":1,"via":"run"}
Ci-Attestation: {"at":1791861901,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"868e711bbf8d5727028157c23fb5f05aaa6a9887147059c6eb03d9d934593d75","lane":"tier2-linux","parents":["64b093d808d49a4afe332985701613d56e3bbda7"],"secs":52,"stamp":"a20c7aad438eb9f41edfa889ce08b0ca","tree":"9bf4a2498f0ab005bd1919bf921447846239031a","v":1,"via":"run"}
@zackees

zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

Additional validation: built the full Qt frontend locally from the PR head in the obs-rust-build:2 Linux container (ENABLE_FRONTEND=ON, optional unavailable plugins disabled). CMake built all 583 steps and linked frontend/obs; VolumeMeter.cpp compiled successfully. The source was mounted read-only and the build used an anonymous volume.

@zackees
zackees merged commit 5ba1b04 into master Oct 13, 2026
10 checks passed
@zackees
zackees deleted the fix/131-volume-meter-race branch October 13, 2026 03:32
zackees added a commit that referenced this pull request Oct 13, 2026
MSVC builds the cmocka tests with warnings as errors, and the int to
float assignments (C4244) broke the Windows Tier 2 build since #442,
which merged without a Windows run.

(cherry picked from commit a03a798)
Local-Gate: v1 tree=f4140f6412d1118b542542df6f929497a8fcdcd3 secs=204 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791866044,"gate":"rust/all/fmt","host":"linux-x86_64","key":"b6916df1b6d51dc3c3a97fd1e18e79dc6d1924f54704de68eb3d2e1fe1a572b7","lane":"lint","parents":["eb955ba16df49ab2c92a32d560acbde669d90325"],"secs":30,"stamp":"a8e0148e8d8332ad3c6d9d7791cbe019","tree":"f4140f6412d1118b542542df6f929497a8fcdcd3","v":1,"via":"run"}
Ci-Attestation: {"at":1791866044,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"b6916df1b6d51dc3c3a97fd1e18e79dc6d1924f54704de68eb3d2e1fe1a572b7","lane":"lint","parents":["eb955ba16df49ab2c92a32d560acbde669d90325"],"secs":30,"stamp":"9ff5cba95920b207741da203e78bc29f","tree":"f4140f6412d1118b542542df6f929497a8fcdcd3","v":1,"via":"run"}
Ci-Attestation: {"at":1791866044,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"4dfb4b5f61dcfd8b23844b3873525b41234345625f54ef82d7f5d5c2cc55d1d3","lane":"rust-test","parents":["eb955ba16df49ab2c92a32d560acbde669d90325"],"secs":113,"stamp":"1c7c7d54bc1ca4367a02f2f524cb2c1f","tree":"f4140f6412d1118b542542df6f929497a8fcdcd3","v":1,"via":"run"}
Ci-Attestation: {"at":1791866044,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"cd28f30d8ed9a88c247264a5f2861954e1d6c2bc1355fdddf49f0465a8708fdd","lane":"tier2-linux","parents":["eb955ba16df49ab2c92a32d560acbde669d90325"],"secs":61,"stamp":"a6740cf1f64c53f6811a7d5405e1c2fa","tree":"f4140f6412d1118b542542df6f929497a8fcdcd3","v":1,"via":"run"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

TSan: VolumeMeter paintEvent reads level/ballistics data without dataMutex

1 participant