{"record":{"id":"d2be72f6a11413bc","repo":"bevyengine/bevy","slug":"failed-to-poll-device-for-map-async","errorCode":null,"errorMessage":"Failed to poll device for map async","messagePattern":"Failed to poll device for map async","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/bevy_render/src/diagnostic/tracy_gpu.rs","lineNumber":75,"sourceCode":"        label: None,\n        size: QUERY_SIZE as _,\n        usage: BufferUsages::MAP_READ | BufferUsages::COPY_DST,\n        mapped_at_creation: false,\n    });\n\n    let mut timestamp_encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());\n    timestamp_encoder.write_timestamp(&query_set, 0);\n    timestamp_encoder.resolve_query_set(&query_set, 0..1, &resolve_buffer, 0);\n    // Workaround for https://github.com/gfx-rs/wgpu/issues/6406\n    // TODO when that bug is fixed, merge these encoders together again\n    let mut copy_encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());\n    copy_encoder.copy_buffer_to_buffer(&resolve_buffer, 0, &map_buffer, 0, Some(QUERY_SIZE as _));\n    queue.submit([timestamp_encoder.finish(), copy_encoder.finish()]);\n\n    map_buffer.slice(..).map_async(MapMode::Read, |_| ());\n    device\n        .poll(PollType::wait_indefinitely())\n        .expect(\"Failed to poll device for map async\");\n\n    let view = map_buffer.slice(..).get_mapped_range().unwrap();\n    i64::from_le_bytes((*view).try_into().unwrap())\n}\n","sourceCodeStart":57,"sourceCodeEnd":80,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_render/src/diagnostic/tracy_gpu.rs#L57-L80","documentation":"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.","triggerScenarios":"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.","commonSituations":"Enabling tracy GPU profiling on GL or restricted drivers; long profiling sessions that hit device loss; platform combinations where mapped-buffer polling is unsupported.","solutions":["Run without the Tracy GPU profiling feature (CPU-side tracy still works) if the platform cannot support it","Verify the adapter supports `wgpu::Features::TIMESTAMP_QUERY` before enabling GPU profiling","Update bevy/wgpu; the surrounding code already carries a workaround for wgpu#6406 and newer releases fix polling behavior"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before enabling GPU profiling, confirm the adapter can do timestamp queries\nlet (adapter, _) = bevy::wgpu::request_adapter_and_device(...);\nlet supported = adapter.features().contains(wgpu::Features::TIMESTAMP_QUERY);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Gate the tracy GPU feature per platform instead of enabling it globally","Check adapter support for TIMESTAMP_QUERY before profiling","Watch for device-loss errors in logs; this panic is often downstream of another fault"],"tags":["bevy","tracy","profiling","wgpu","timestamps","device-lost"],"backgroundTag":"wgpu-device-poll-failure","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}