Skip to content

WebGPU: a lost device aborts the process on native hosts #26086

Open

Description

@MartinZikmund

Current behavior 🐛

With the WebGPU renderer on a native host, a lost GPU device kills the app. wgpu-native treats an error from a handful of its calls as fatal: it panics, a panic can't cross into managed code, and the process aborts. try/catch can't help.

Seen on Android WebGPU shard 2 of build 243859 (SwiftShader adapter, API 36 emulator), where it cost the whole shard's test results:

panicked at src/lib.rs:605:5: Error in wgpuSurfaceGetCurrentTexture: Validation Error. Caused by: Parent device is lost
panicked at src/lib.rs:605:5: Error in wgpuQueueSubmit: Validation Error. Caused by: Parent device is lost
fatal runtime error: failed to initiate panic, error 5, aborting
Got a SIGABRT while executing native code
  at Uno.UI.Composition.WebGpu.WebGpuSwapChainContext.Present()
  at Uno.UI.Runtime.Android.UnoWebGpuView.RenderFrame(RenderSession)

Expected behavior 🎯

A lost device stops rendering, says so once in the log, and leaves the process running.

How to reproduce it (as minimally and precisely as possible) 🔬

  1. Run a desktop app with UNO_WEBGPU=1.
  2. Call DeviceDestroy on the device from a WebGpuCanvasElement's RenderOverride.
  3. Let the app render another frame. The process aborts with Error in wgpuQueueSubmit: ... Parent device is lost.

The CI crash itself is intermittent and has not been reproduced locally.

Workaround 🛠️

None in the product. Use another renderer.

Affected platforms 📱💻🖥️

Android, Windows (Skia), macOS (Skia), Linux (Skia), and iOS by the shared code. Only Windows with Vulkan was exercised directly, besides the Android crash above. WebAssembly is separate: it stays alive without recovering (#25361).

Uno.Sdk version (and other relevant versions) 📦

master at 82407c0, wgpu-native v29.0.1.1, .NET 11 RC 3.

IDE version 🧑‍💻

Not relevant.

Anything else we need to know? 💬

Read from the wgpu-native v29.0.1.1 and wgpu-core 29.0.1 sources:

  • wgpuSurfaceGetCurrentTexture, wgpuQueueSubmit, wgpuQueueSubmitForIndex, wgpuSurfaceConfigure, wgpuDevicePoll, wgpuBufferGetMappedRange and the discard in wgpuTextureRelease call handle_error_fatal, which panics. Other calls route errors to the callbacks.
  • The lost-device callback isn't fired when the device is lost. It fires only when a non-fatal call runs into the loss, which is why the CI log has no device lost line before the panic.
  • wgpu_hal's vulkan native swapchain can turn timeouts into device losses. gfx-rs/wgpu#9029: the Vulkan acquire reports a fence wait over one second as a lost device. The first panic in the CI log comes from that call, and the app has a similar stall on record, so this is the likely trigger on the emulator. That part is inferred, not proven.

Activity

  1. added
    kind/bug
    on Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions