bevyengine/bevy · error

Failed to poll device for map async

Error message

Failed to poll device for map async

What it means

With Tracy GPU profiling enabled, bevy_render's tracy_gpu helper writes a GPU timestamp, resolves it into a staging buffer, calls `map_async`, and blocks on `device.poll(PollType::wait_indefinitely()).expect("Failed to poll device for map async")`. The panic fires when the poll returns an error: typically a lost or invalidated wgpu device, or a platform where the indefinite poll cannot satisfy the map.

Source

Thrown at crates/bevy_render/src/diagnostic/tracy_gpu.rs:75

        label: None,
        size: QUERY_SIZE as _,
        usage: BufferUsages::MAP_READ | BufferUsages::COPY_DST,
        mapped_at_creation: false,
    });

    let mut timestamp_encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());
    timestamp_encoder.write_timestamp(&query_set, 0);
    timestamp_encoder.resolve_query_set(&query_set, 0..1, &resolve_buffer, 0);
    // Workaround for https://github.com/gfx-rs/wgpu/issues/6406
    // TODO when that bug is fixed, merge these encoders together again
    let mut copy_encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());
    copy_encoder.copy_buffer_to_buffer(&resolve_buffer, 0, &map_buffer, 0, Some(QUERY_SIZE as _));
    queue.submit([timestamp_encoder.finish(), copy_encoder.finish()]);

    map_buffer.slice(..).map_async(MapMode::Read, |_| ());
    device
        .poll(PollType::wait_indefinitely())
        .expect("Failed to poll device for map async");

    let view = map_buffer.slice(..).get_mapped_range().unwrap();
    i64::from_le_bytes((*view).try_into().unwrap())
}

View on GitHub (pinned to 396ca72708)

Solutions

  1. Run without the Tracy GPU profiling feature (CPU-side tracy still works) if the platform cannot support it
  2. Verify the adapter supports `wgpu::Features::TIMESTAMP_QUERY` before enabling GPU profiling
  3. Update bevy/wgpu; the surrounding code already carries a workaround for wgpu#6406 and newer releases fix polling behavior
Defensive patterns

Strategy: fallback

Validate before calling

// before enabling GPU profiling, confirm the adapter can do timestamp queries
let (adapter, _) = bevy::wgpu::request_adapter_and_device(...);
let supported = adapter.features().contains(wgpu::Features::TIMESTAMP_QUERY);

Prevention

When it happens

Trigger: Running a build with the Tracy GPU profiling feature chain on a backend where timestamp queries or indefinite polling fail, or losing the device (driver reset, invalid usage elsewhere) while the profiler is mapping timestamp buffers.

Common situations: Enabling tracy GPU profiling on GL or restricted drivers; long profiling sessions that hit device loss; platform combinations where mapped-buffer polling is unsupported.

Related errors


AI-assisted analysis of bevyengine/bevy@396ca72708 (2026-08-20). Data as JSON: /api/errors/d2be72f6a11413bc. Report an issue: GitHub.