Repository navigation
fix(editor): keep the OS memory pressure source out of audio cache unit tests - #3029
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Fixes the intermittent
sync-tests (macos-latest)failures inaudio::tests::a_replay_resumes_a_parked_renderandaudio::tests::a_stale_render_is_released_once_the_next_render_finishes(added in #2521).Cause
PlaybackAudioCache::with_idle_releasecallsmemory_pressure::watch()(crates/editor/src/audio.rs:1786), which installs a real process-wideDISPATCH_SOURCE_TYPE_MEMORYPRESSUREsource. Its handler callsrelease_playback_audio_caches()(audio.rs:1761), which empties every cache in the process.The tests guard the simulated release in
export_and_memory_pressure_release_every_cached_renderwith theCACHE_RELEASEwrite lock (audio.rs:4724), but nothing guards the real OS source. On a loaded macOS runner a warn-level pressure event can arrive at any time, and every test that asserts a cached render is still there fails together:a_replay_resumes_a_parked_render(audio.rs:5378): the entry is gone, sofrom_cachemisses and the replay builds a fresh render.a_stale_render_is_released_once_the_next_render_finishes(audio.rs:5269): the paused render is freed before the 50 ms check.In run 2755 both tests failed within 62 ms of each other, which fits one process-wide release and not two independent races. The product behaviour is intended: under memory pressure the parked render should be dropped and the next play renders fresh.
Fix
memory_pressure::watch()returns early undercfg!(test), so the editor's unit tests no longer receive host memory pressure events. The release path is still covered by callingon_memory_pressuredirectly inexport_and_memory_pressure_release_every_cached_render. Non-test builds are unchanged. No assertions, sleeps or timeouts were changed.Verification
CI on this PR: A/V Sync Tests passed on macOS, Ubuntu and Windows (45 checks green).
export_and_memory_pressure_release_every_cached_renderstill covers the release path by callingon_memory_pressuredirectly. Before the fix, 3 of 14 macOS sync-tests runs on unrelated PRs failed these two tests, and two of the failures landed within 62 ms of each other in one run, which points to a single process-wide release.

Confidence Score: 5/5
The PR appears safe to merge; it isolates unit tests without changing production behavior.Summary
Prevents macOS memory pressure events from clearing audio caches during editor unit tests.
Reviews (1) · Last reviewed commit: "fix(editor): keep the OS memory pressure..." · Reviewed by Greptile