Repository navigation
frontend: Free disk space is queried off the UI thread (#1282) - #1336
Merged
Merged
Conversation
zackees
enabled auto-merge
October 17, 2026 20:09
Member
Author
chriscoveries
pushed a commit
to chriscoveries/obsrust-fork
that referenced
this pull request
Oct 17, 2026
… ms (obs-rust#1338) test_ingest_refresh_wait (obs-rust#1326) required a 50 ms refresh to end the wait within 150 ms; a loaded macOS runner overslept it (failed_refresh_ends_wait, line 66, Tier 2 macos-26 on obs-rust#1336). What the test proves is that the wait ends at the refresh and not at the 5000 ms timeout, so bound it at 1000 ms. Refs obs-rust#1284, obs-rust#838
RED: DiskSpaceMonitor stub queries synchronously on the caller's thread.
DiskSpaceMonitor runs os_get_free_disk_space() on one worker thread, coalescing requests; the recording timer and the stats window read the last value instead of blocking on statvfs/GetDiskFreeSpaceEx.
zackees
force-pushed
the
fix/1282-disk-space-off-ui
branch
from
October 17, 2026 21:15
0e65c71 to
427f706
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1282 (parent #1273). Refs, not Fixes: the real app has not been run against a hung network path yet; #1282 closes after that check. Features ledger line added (docs/features.md, Scenes and UI).
Cause
The recording timer (
OBSBasic::CheckDiskSpaceRemaining, every 1 s while recording) and the stats window (OBSBasicStats::Update, every 2 s while it is visible) calledos_get_free_disk_space()on the UI thread. On a hung network or NAS recording path, statvfs / GetDiskFreeSpaceEx can block for seconds, and the UI froze for that long.Design
frontend/utility/disk-space-monitor.{hpp,cpp.hpp}is a Qt-free helper (its own unity group and PCH per BUILD.md) that owns one worker thread:request(path)returns at once and coalesces requests: at most one query runs at a time, a request for the path already being queried is dropped, and a request for another path takes the single pending slot.latest(path)returns{bytes, timestamp_ns (os_gettime_ns), valid}for the last finished query of that path. A value for one path is never reported for another.os_get_free_disk_space.shared_ptrto the state, so when the query finally returns it touches no freed memory and exits without starting another query.How the UI uses it:
RECORD_MIN_FREE_BYTES, same stop and message). It does nothing until such a value exists. The URL and no-path cases return early, as before.RECORD_DISK_CHECK_START) is still synchronous.Tests
test/cmocka/test_disk_space_monitor.cppis new, registered throughtests.d/test_disk_space_monitor.cmake. No existing test was edited. The injected free-space function blocks for 2 s. The test checks that:request+latestreturn in under 10 ms, and the value appears once the query completes;latest(new)is invalid until the new path's value (222) arrives;RED (449c3c3, a stub that runs the query synchronously on the caller's thread),
rust/tools/linux-validate/run.sh --repeat 1 --tests test_disk_space_monitor: all 4 cases failed, andtest_disk_space_monitorwas the only failing test (286/287 passed).GREEN (70fcf22), same command: 287/287 passed in both the libobs (OFF) and libobs-with-rust (ON) builds, and the
--repeatruns passed too (8.4 s each).Tier 3 and Tier 4 do not apply: this is frontend C++ with no Rust port and no protocol change.
Qt CI lane
The
OBSBasic/OBSBasicStatsedits are underfrontend/, soci/ci_scope.pyselects the Linux Qt lane (ci/linux_qt_frontend.sh), which compiles and links theobs-studioQt target. That build is the compile check for the UI call sites; I could not build the Qt frontend locally (no prebuilt Qt prefix here). The new test is not Qt-linked and runs in Tier 2. I have not run the real app with this change, so the behaviour on a hung NAS path is shown only by the unit test.