Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface::configure can panic with "map callback was leaked" #4214

Closed
DJMcNab opened this issue Oct 6, 2023 · 4 comments · Fixed by #4220 or #4227
Closed

Surface::configure can panic with "map callback was leaked" #4214

DJMcNab opened this issue Oct 6, 2023 · 4 comments · Fixed by #4220 or #4227

Comments

@DJMcNab
Copy link
Contributor

DJMcNab commented Oct 6, 2023

Description
When Surface::configure is called, it's possible for the panic at:

impl Drop for BufferMapCallback {
fn drop(&mut self) {
if self.inner.is_some() {
panic!("Map callback was leaked");
}
}
}

to trigger, specifically when:
if let Err(e) = device.maintain(hub, wgt::Maintain::Wait, &mut token) {
break e.into();
}

returned a non-empty Ok

Repro steps
Running vello's examples (since linebender/vello#350, at the time of writing linebender/vello@34483eb).
Pressing v to toggle vsync (and force a reconfigure) may also be required, although sometimes for reasons unknown this isn't needed

Expected vs observed behavior
I expected for a panic not to occur

I observed that a panic occured

Platform
Wayland Gnome on Fedora 38 on an intel i5-1240p
Reproduction also confirmed on "on Sway and with an amdgpu"

@benjamin-sieffert
Copy link

Running into the same issue after upgrading wgpu-core from 0.17.0 to 0.17.1.
Since supposedly it is related to VSync, here is what happens for me, using amdgpu kernel driver on linux, no amdvlk installed, i.e. vulkan via mesa is used (as far as I understand all this).
Automatically choosing presentation mode by rule AutoNoVsync. Chose Immediate
My monitor can do FreeSync, though. Maybe first Immediate is used, but then immediately switched to Adaptive-Sync?

@dhardy
Copy link
Contributor

dhardy commented Oct 10, 2023

#4220 does not fix this for me: I still get "Map callback was leaked" when resizing a window using 152c239.

Reproduce:

git clone https://github.com/kas-gui/kas.git --single-branch --branch wgpu
cd kas
cargo run --example layout
# resize the window

@DJMcNab
Copy link
Contributor Author

DJMcNab commented Oct 10, 2023

It looks to me like the callbacks are only called if there's an error

Not checked the code on a big screen though

@nical
Copy link
Contributor

nical commented Oct 10, 2023

Gosh, you are right, that fix wasn't very good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants