Repository navigation
Desktop tests: share one wgpu device (fixes a crash in parallel runs on Windows) - #35
Open
Skyfuller1303 wants to merge 3 commits into
Open
Skyfuller1303 wants to merge 3 commits into
Skyfuller1303 wants to merge 3 commits into
Conversation
Every ui test built its harness with `.wgpu()`, which creates a fresh wgpu instance and device (WARP on Windows) per test. The tests run on parallel threads, and creating and dropping several D3D12 devices at the same time crashed the test process with STATUS_ACCESS_VIOLATION (0xc0000005) in the middle of the run, in most runs of `cargo test -p craft-cloud-desktop --lib` on Windows. With `--test-threads=1` it never happened. Create the instance, adapter, device and queue once, keep them in a `OnceLock` (so no device is torn down while other threads render) and hand them to each harness with `wgpu_setup(WgpuSetup::Existing(..))`. Every harness still gets its own renderer. Snapshots are unchanged. Test code only; this works on every backend kittest picks (lavapipe, WARP, Metal).
This was referenced Nov 6, 2026
Other test modules of the app (such as a Security page test module in a stacked pull request) build their own kittest harnesses. Make shared_wgpu() visible to them, so all of the app's harnesses render on one device.
Skyfuller1303
added a commit
to Skyfuller1303/craft-cloud
that referenced
this pull request
Nov 7, 2026
…ce between the desktop tests
Skyfuller1303
added a commit
to Skyfuller1303/craft-cloud
that referenced
this pull request
Nov 7, 2026
The Security page tests (from itrycodinganditsbad#19) built their kittest harness with .wgpu(), a new wgpu device per test, which crashed the test process with STATUS_ACCESS_VIOLATION when run in parallel on Windows, like the other UI tests did before itrycodinganditsbad#35. Use the shared device from itrycodinganditsbad#35 here too.
…0547 corrupts the heap otherwise)
This was referenced Nov 10, 2026
Server: SFTP as a blob store, and authenticated backups to SFTP (after the compression-admin PR)
#70
Open
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.
cargo test -p craft-cloud-desktop --libcrashes on Windows in most runs with0xc0000005, STATUS_ACCESS_VIOLATION. It happens onmaintoo: 4 of 5 parallel runs crashed there. With--no-capturethe process dies after 42 to 44 of the 51 tests, without atest resultline, so the crash comes in the middle of the run and not at exit. With--test-threads=1it never happened.Cause
Every UI test built its harness with
.wgpu(), which creates a new wgpu instance and device (WARP, D3D12 on Windows) for each test. The tests run on parallel threads, so several D3D12 devices were created and dropped at the same time. Creating the device once makes the crash go away. I haven't debugged the access violation inside WARP itself.Change
Test code only, in
apps/craft-cloud-desktop/src/ui/tests.rs.First version:
shared_wgpu()creates the instance, adapter, device and queue once and every harness uses it. That was not enough on Windows. Creating, drawing with and dropping renderers on the shared device from several threads still corrupted the heap now and then: the DX12 shader blob reference counts in wgpu are not thread-safe (gfx-rs/wgpu#10547), and parallel WARP rendering has its own problems (emilk/egui#8772).Current version (
29b95db): rendering goes through a global lock.serialized()returns a renderer whose construction,handle_delta,renderandDropall run under one mutex (a poisoned lock is ignored), so only one test renders at a time.harness()uses.renderer(serialized());shared_wgpu()stays. It costs about 8 % of the wall time of the desktop lib tests (about 29.3 s to 31.8 s for 431 tests on the larger branches). Once a wgpu release that contains gfx-rs/wgpu#10805 is used, the lock andSerializedcan go and the tests can return to.wgpu_setup(shared_wgpu()).There are no dependency or lock-file changes. Snapshots are unchanged. The Security page tests from #19 build their own harness; #34 (merged last) makes the matching change in them once this PR is in.
Testing (Windows)
main, 4 crashed. The pristinemainstill crashes (0xc0000005) incargo test -p craft-cloud-desktop --lib.29b95db:cargo fmt --all --checkandcargo clippy --workspace --all-targets --locked -- -D warningspass;cargo test -p craft-cloud-desktop --libpassed three times in a row (51 tests each, one run withRUST_TEST_THREADS=48). No snapshot file changed.cargo test --workspace --lockedon this head ran 1004 tests with none failing in the tests themselves. The command still exits non-zero here because the agent'slive_documentstest binary aborts with an out-of-memory error on branches based onmain; that is Agent: build historical live snapshots without Loro's checkout (fixes #15) #16, unrelated to this PR.