Closed valentinegb closed 8 months ago
I am able to reproduce the issue with the provided sample project. Runs fine using stable 1.75.0 from rustup
.
Here's the backtrace from LLDB when the Homebrew Rust-built binary crashes:
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x0000000187c017f4 libsystem_platform.dylib`_platform_memmove + 420
frame #1: 0x00000001015257c8 rubiks_cube_ai`_$LT$alloc..string..String$u20$as$u20$core..fmt..Write$GT$::write_str::h575a4f76ab2f0c2c + 64
frame #2: 0x000000010153ea48 rubiks_cube_ai`core::fmt::write::h81cbefbffc581dab + 420
frame #3: 0x0000000101526324 rubiks_cube_ai`_$LT$std..panicking..begin_panic_handler..FormatStringPayload$u20$as$u20$core..panic..PanicPayload$GT$::get::h7ae023883a7e8b62 + 60
frame #4: 0x000000010152645c rubiks_cube_ai`std::panicking::rust_panic_with_hook::h1767d40d669aa9fe + 156
frame #5: 0x0000000101519980 rubiks_cube_ai`std::panicking::begin_panic_handler::_$u7b$$u7b$closure$u7d$$u7d$::h83ff281d56dc913c + 148
frame #6: 0x00000001015193a8 rubiks_cube_ai`std::sys_common::backtrace::__rust_end_short_backtrace::h2f399e8aa761a4f1 + 12
frame #7: 0x00000001015261fc rubiks_cube_ai`rust_begin_unwind + 64
frame #8: 0x00000001016da9e8 rubiks_cube_ai`core::panicking::panic_fmt::hc32404f2b732859f + 52
frame #9: 0x00000001016da8d4 rubiks_cube_ai`core::result::unwrap_failed::h2ea3b6e22f1f6a7c + 92
frame #10: 0x0000000100e30128 rubiks_cube_ai`core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$mut$u20$F$GT$::call_once::hcdee3163bc86d7ee at result.rs:1077:23 [opt]
frame #11: 0x0000000100e30104 rubiks_cube_ai`core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$mut$u20$F$GT$::call_once::hcdee3163bc86d7ee at storage.rs:56:9 [opt]
frame #12: 0x0000000100e30104 rubiks_cube_ai`core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$mut$u20$F$GT$::call_once::hcdee3163bc86d7ee at resource.rs:1403:40 [opt]
frame #13: 0x0000000100e30104 rubiks_cube_ai`core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$mut$u20$F$GT$::call_once::hcdee3163bc86d7ee(self=<unavailable>, args=<unavailable>) at function.rs:305:13 [opt]
frame #14: 0x0000000100df9578 rubiks_cube_ai`wgpu_core::device::global::_$LT$impl$u20$wgpu_core..global..Global$LT$G$GT$$GT$::device_create_texture::hfcb0ab75e8f77c6a(self=<unavailable>, device_id=Id<wgpu_core::device::resource::Device<wgpu_hal::empty::Api>> @ x25, desc=<unavailable>, id_in=<unavailable>) at global.rs:597:33 [opt]
frame #15: 0x0000000100e63334 rubiks_cube_ai`_$LT$wgpu..backend..direct..Context$u20$as$u20$wgpu..context..Context$GT$::device_create_texture::hb01ee5ceaa5fcb76(self=0x00000001360a1010, device=0x000000016fdfb1d0, device_data=0x0000600003eff920, desc=0x000000016fdfb288) at direct.rs:1310:27 [opt]
frame #16: 0x0000000100e6bf98 rubiks_cube_ai`_$LT$T$u20$as$u20$wgpu..context..DynContext$GT$::device_create_texture::hb6dcd4f9b42467ca(self=0x00000001360a1010, device=<unavailable>, device_data=&(dyn core::any::Any + core::marker::Send + core::marker::Sync) @ 0x00006000012c3c80, desc=0x000000016fdfb288) at context.rs:2349:31 [opt]
frame #17: 0x0000000100edb5d4 rubiks_cube_ai`_$LT$wgpu..Device$u20$as$u20$wgpu..util..device..DeviceExt$GT$::create_texture_with_data::h737053d29cdc77c8 [inlined] wgpu::Device::create_texture::h5347b6873328c8e9(self=<unavailable>, desc=0x000000016fdfb288) at lib.rs:2455:13 [opt]
frame #18: 0x0000000100edb5a0 rubiks_cube_ai`_$LT$wgpu..Device$u20$as$u20$wgpu..util..device..DeviceExt$GT$::create_texture_with_data::h737053d29cdc77c8(self=<unavailable>, queue=0x0000600002bdc510, desc=<unavailable>, data=(data_ptr = "\xff\xff\xff\xff", length = 4)) at device.rs:86:23 [opt]
frame #19: 0x0000000100b39cdc rubiks_cube_ai`bevy_render::texture::fallback_image::fallback_image_new::h999a312718277da8 [inlined] bevy_render::renderer::render_device::RenderDevice::create_texture_with_data::hca2976d4134f1d4d(self=<unavailable>, render_queue=<unavailable>, desc=<unavailable>, data=<unavailable>) at render_device.rs:158:28 [opt]
frame #20: 0x0000000100b39ccc rubiks_cube_ai`bevy_render::texture::fallback_image::fallback_image_new::h999a312718277da8(render_device=<unavailable>, render_queue=<unavailable>, default_sampler=<unavailable>, format=TextureFormat @ 0x000000016fdfb834, dimension=D3, samples=1, value='\xff') at fallback_image.rs:93:9 [opt]
frame #21: 0x0000000100b3a130 rubiks_cube_ai`_$LT$bevy_render..texture..fallback_image..FallbackImage$u20$as$u20$bevy_ecs..world..FromWorld$GT$::from_world::h868f99fa5ac5d776(world=<unavailable>) at fallback_image.rs:170:17 [opt]
frame #22: 0x0000000100b3b224 rubiks_cube_ai`_$LT$bevy_render..texture..ImagePlugin$u20$as$u20$bevy_app..plugin..Plugin$GT$::finish::hb0e5de63c0f9f491 at mod.rs:1053:25 [opt]
frame #23: 0x0000000100b3b14c rubiks_cube_ai`_$LT$bevy_render..texture..ImagePlugin$u20$as$u20$bevy_app..plugin..Plugin$GT$::finish::hb0e5de63c0f9f491 [inlined] bevy_app::app::App::init_resource::hab75186c0c64d970 at app.rs:570:9 [opt]
frame #24: 0x0000000100b3b14c rubiks_cube_ai`_$LT$bevy_render..texture..ImagePlugin$u20$as$u20$bevy_app..plugin..Plugin$GT$::finish::hb0e5de63c0f9f491(self=<unavailable>, app=<unavailable>) at mod.rs:144:18 [opt]
frame #25: 0x00000001014204f0 rubiks_cube_ai`bevy_app::app::App::finish::h4b6214d42fc0503b(self=0x000000016fdfd990) at app.rs:340:13 [opt]
frame #26: 0x00000001000c8710 rubiks_cube_ai`bevy_winit::winit_runner::h0df546c6bc962b5a(app=App @ 0x000000016fdfd990) at lib.rs:353:9 [opt]
frame #27: 0x00000001000d0748 rubiks_cube_ai`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h219a897c2111426b [inlined] core::ops::function::FnOnce::call_once::ha3d0930a91c7f479((null)=<unavailable>, (null)=(bevy_app::app::App) @ 0x000000016fdfd990) at function.rs:250:5 [opt]
frame #28: 0x00000001000d0740 rubiks_cube_ai`core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::h219a897c2111426b((null)=<unavailable>, (null)=<unavailable>) at function.rs:250:5 [opt]
frame #29: 0x00000001014203d8 rubiks_cube_ai`bevy_app::app::App::run::h9d45034dd72117bb [inlined] _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::he96f0e89ace8844e(self=alloc::boxed::Box<(dyn core::ops::function::FnOnce<(bevy_app::app::App), Output=()> + core::marker::Send), alloc::alloc::Global> @ 0x0000600001293c00, args=(bevy_app::app::App) @ 0x000000016fdfe0d0) at boxed.rs:2007:9 [opt]
frame #30: 0x00000001014203c8 rubiks_cube_ai`bevy_app::app::App::run::h9d45034dd72117bb(self=<unavailable>) at app.rs:314:9 [opt]
frame #31: 0x000000010001ac24 rubiks_cube_ai`rubiks_cube_ai::main::h7bfc36a028c85149 at main.rs:16:5 [opt]
frame #32: 0x0000000100003620 rubiks_cube_ai`std::sys_common::backtrace::__rust_begin_short_backtrace::h355a46e49634a754 [inlined] core::ops::function::FnOnce::call_once::hfb0fe7e1e0f038b9((null)=<unavailable>, (null)=<unavailable>) at function.rs:250:5 [opt]
frame #33: 0x000000010000361c rubiks_cube_ai`std::sys_common::backtrace::__rust_begin_short_backtrace::h355a46e49634a754(f=<unavailable>) at backtrace.rs:154:18 [opt]
frame #34: 0x00000001000191d8 rubiks_cube_ai`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h9461ce03e34ff879 at rt.rs:167:18 [opt]
frame #35: 0x00000001015260e8 rubiks_cube_ai`std::panicking::try::h0f4fc6a6c293a630 + 28
frame #36: 0x000000010152db38 rubiks_cube_ai`std::rt::lang_start_internal::h87f8a3eec40cef68 + 56
frame #37: 0x00000001000191bc rubiks_cube_ai`std::rt::lang_start::ha0025e75671b6ebc(main=<unavailable>, argc=<unavailable>, argv=<unavailable>, sigpipe=<unavailable>) at rt.rs:166:17 [opt]
frame #38: 0x000000010001b9cc rubiks_cube_ai`main + 32
frame #39: 0x00000001878510e0 dyld`start + 2360
I also got this message to show up once but was unclear whether I built it with brewed Rust or rustup
Rust when I got this. Maybe it's related, though.
thread 'main' panicked at /Users/caleb/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.17.2/src/backend/direct.rs:3056:5:
wgpu error: Validation Error
Caused by:
In Device::create_texture
Texture format Rgba8UnormSrgb can't be used due to missing features
Features Features(TIMESTAMP_QUERY | INDIRECT_FIRST_INSTANCE | PIPELINE_STATISTICS_QUERY | 0x10) are required but not enabled on the device
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Seems like that it's crashing in panic handling - so a crash because of another crash. While that shouldn't happen, that panic noted here nevertheless seems likely to be the initial cause.
It looks like segfault is impacted by optimization. I don't see a segfault with a standard debug build removing optimization options in Cargo.toml.
More specifically, optimizing wgpu
and wgpu-types
with opt-level 3 results in segfault.
Rebuilding Homebrew rust
with bundled LLVM doesn't segfault. I think the LLVM version should be the same but could be some difference in features.
Possible fix might be #159174
By the way, it should be noted that rustup-init
does not have the same issue, so anyone looking for a workaround while still using Homebrew I would recommend you brew install rustup-init
for now.
@Bo98 I can confirm that your patch resolves this issue!
brew gist-logs <formula>
link ORbrew config
ANDbrew doctor
outputVerification
brew doctor
output" saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
I am attempting to run specifically my Rust project https://github.com/valentinegb/rubiks-cube-ai with
cargo run
on a new computer with Rust installed via Homebrew.What happened (include all command output)?
A window did not open despite being expected and the program ended early with the following output:
What did you expect to happen?
A window is expected to open displaying a 3D model of a Rubik's Cube and a grey rectangle on the right side. When the window is closed, the program ends normally. When Rust is installed as recommended on the Rust website, this is what happens.
Step-by-step reproduction instructions (by running
brew
commands)