-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Segfault while adding a state #2464
Comments
What is the stacktrace? Does it reproduce when you only add a single or no states? |
Happens only when a second state is added. Full stacktrace here:
|
I just tried it on Windows 10 (bevy 0.5) and got the same error message with a standard panic. I wonder why that's getting turned into a segfault instead... |
I suspect there is either a bug somewhere in wgpu's handling of destroying the vulkan context when unwinding causing UB manifesting as SIGSEGV in this case. Or an ordering issue between destorying the vulkan context by wgpu and the X11/Wayland context in winit caused by bevy. |
Agreed. @saveriomiroddi does this occur without Does it occur for other panics, such as the one produced by this snippet? use bevy::prelude::*;
struct UninitResource;
fn resource_system(res: Res<UninitResource>) {}
fn main() {
App::build()
.add_plugins(DefaultPlugins)
.add_system(resource_system.system())
.run();
} |
So!
Note that this time, I've tested only on one machine (Nvidia). |
Okay sweet, so it's probably a GPU / windowing cleanup issue like @bjorn3 commented. If you happen to have other OS's for the same machine installed that would be great, otherwise we can see if we can get other Linux folks to reproduce it. |
I believe I have seen this crash in other issues where a panic happened. |
Other OS's like Windows? If so, I can do that on the other machine (which had the same behavior; my workstation has a tricky setup). It'll take a bit, since I have to prepare a Windows to go flash key and run the cross-compiled executable on it, but I can. |
@saveriomiroddi that would be much appreciated. It would help us start to narrow this down and verify that it's a driver / OS issue, rather than a hardware problem. |
So, I've run the program on Windows 10 x64, on one of the two machines that segfaults when running it on Linux, and it didn't segfault. I'm not 100% sure how a hypothetical segfault would be, but I didn't see anything aside the panic in the console (and a window flashing for a very brief moment). |
In case this is not clear for others hitting this bug, or what appears to be it at first if a search for the error message led you on this bug, the bug here is I think about the segfault instead of panic, not about the code being wrong in the first place. But it's nonetheless very easy to write wrong code due to Only call I was hitting the same thing, yet the official examples work. Looking carefully, all 4 examples using state call Note that to confirm I'm hitting the same callstack and error message with a second |
States got fully reworked in #6587 . This is not an issue anymore. |
Bevy version
0.5.0
Operating system & version
Ubuntu 20.04 MATE, tested on two separate machines (Nvidia/Intel).
Rust: rustc 1.55.0-nightly (432e145bd 2021-07-10)
Other Rust tested: rustc 1.53.0 (53cb7b09b 2021-06-17)
What you did
Listing follows. Note that this is incorrect logic, but I believe that this should not segfault regardless.
The segfault reproduces 100% of the times, on two machines, both on stable and nightly.
What you expected to happen
Panic, but no segfault.
What actually happened
Stack trace, ending with:
The text was updated successfully, but these errors were encountered: