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

metal-rs examples fail with SIGILL on recent nightlies, still works on stable #35

Open
alexbool opened this issue Apr 5, 2018 · 1 comment
Labels

Comments

@alexbool
Copy link
Contributor

alexbool commented Apr 5, 2018

Running examples (from HEAD of this repository) fails:

alexbool@alexbool-osx ~/D/I/metal-rs> cargo run --example compute
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/examples/compute`
fatal runtime error: allocator memory exhausted
fish: 'cargo run --example compute' terminated by signal SIGILL (Illegal instruction)

alexbool@alexbool-osx ~/D/I/metal-rs> rust-lldb -- target/debug/examples/compute
(lldb) command source -s 0 '/tmp/rust-lldb-commands.9JfQTt'
Executing commands in '/tmp/rust-lldb-commands.9JfQTt'.
(lldb) command script import "/Users/alexbool/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/etc/lldb_rust_formatters.py"
(lldb) type summary add --no-value --python-function lldb_rust_formatters.print_val -x ".*" --category Rust
(lldb) type category enable Rust
(lldb) target create "target/debug/examples/compute"
Current executable set to 'target/debug/examples/compute' (x86_64).
(lldb) r
Process 4860 launched: '/Users/alexbool/Documents/IdeaProjects/metal-rs/target/debug/examples/compute' (x86_64)
fatal runtime error: allocator memory exhausted
compute was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 4860 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
    frame #0: 0x000000010004e6fa compute`alloc_system::platform::_$LT$impl$u20$core..heap..Alloc$u20$for$u20$$RF$$u27$a$u20$alloc_system..System$GT$::oom::haae5aa67e0537221 at lib.rs:215 [opt]
Target 0: (compute) stopped.
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #0: 0x000000010004e6fa compute`alloc_system::platform::_$LT$impl$u20$core..heap..Alloc$u20$for$u20$$RF$$u27$a$u20$alloc_system..System$GT$::oom::haae5aa67e0537221 at lib.rs:215 [opt]
    frame #1: 0x000000010004e698 compute`_$LT$alloc_system..System$u20$as$u20$core..heap..Alloc$GT$::oom::h6b14a7ed86d10e67 at lib.rs:78 [opt]
    frame #2: 0x000000010002800c compute`__rde_oom at lib.rs:124 [opt]
    frame #3: 0x000000010001aff9 compute`_$LT$alloc..heap..Heap$u20$as$u20$core..heap..Alloc$GT$::oom::h6fe185a73e220d75 at heap.rs:98 [opt]
    frame #4: 0x000000010001ae83 compute`_$LT$alloc..raw_vec..RawVec$LT$T$C$$u20$A$GT$$GT$::reserve::h31aa44fa05bc4469 at raw_vec.rs:558 [opt]
    frame #5: 0x000000010001582f compute`_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5b108bba9b49131a [inlined] _$LT$alloc..vec..Vec$LT$T$GT$$GT$::reserve::h68934e9fd0fc8180 at vec.rs:465 [opt]
    frame #6: 0x0000000100015823 compute`_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5b108bba9b49131a [inlined] _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..SpecExtend$LT$$RF$$u27$a$u20$T$C$$u20$core..slice..Iter$LT$$u27$a$C$$u20$T$GT$$GT$$GT$::spec_extend::h126e6b75cdf416ca at vec.rs:1859 [opt]
    frame #7: 0x0000000100015823 compute`_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5b108bba9b49131a [inlined] _$LT$alloc..vec..Vec$LT$T$GT$$GT$::extend_from_slice::h7fec1563e64426ee at vec.rs:1346 [opt]
    frame #8: 0x0000000100015823 compute`_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5b108bba9b49131a [inlined] alloc::string::String::push_str::hd3e5f3c347641c54 at string.rs:805 [opt]
    frame #9: 0x0000000100015823 compute`_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5b108bba9b49131a [inlined] _$LT$alloc..string..String$u20$as$u20$core..fmt..Write$GT$::write_str::h3fb28a11f607cf9d at string.rs:2277 [opt]
    frame #10: 0x0000000100015823 compute`_$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h5b108bba9b49131a at mod.rs:214 [opt]
    frame #11: 0x000000010000e172 compute`_$LT$alloc..string..String$u20$as$u20$core..fmt..Display$GT$::fmt::hc867ffd54fb6e644(self=&0x7ffeefbff0f0, f=&0x7ffeefbfef78) at string.rs:1860
    frame #12: 0x000000010000e798 compute`_$LT$objc..message..MessageError$u20$as$u20$core..fmt..Display$GT$::fmt::hdca7e778728ba39e(self=&0x7ffeefbff0f0, f=&0x7ffeefbfef78) at mod.rs:157
    frame #13: 0x0000000100051999 compute`core::fmt::write::hd6c4ef3dd62ed92b [inlined] core::fmt::Formatter::run::h1e9c4a7161cf2c85 at mod.rs:1100 [opt]
    frame #14: 0x0000000100051814 compute`core::fmt::write::hd6c4ef3dd62ed92b at mod.rs:1047 [opt]
    frame #15: 0x0000000100016dc4 compute`std::panicking::begin_panic_fmt::hccd237cdae61db17 [inlined] core::fmt::Write::write_fmt::h1f0dbd48320f1e1a at mod.rs:226 [opt]
    frame #16: 0x0000000100016d89 compute`std::panicking::begin_panic_fmt::hccd237cdae61db17 at panicking.rs:348 [opt]
    frame #17: 0x0000000100008211 compute`metal_rs::encoder::CommandEncoderRef::end_encoding::h7ba072b0c0038804(self=&0x100211440) at encoder.rs:135
    frame #18: 0x000000010000581b compute`compute::main::h3c95dc9e471369d8 at main.rs:78
    frame #19: 0x0000000100002e22 compute`std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h07c3d44bb113f1a4 at rt.rs:74
    frame #20: 0x0000000100016d08 compute`std::panicking::try::do_call::h7faedbe63ef0ecf9 [inlined] std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::h73acc47e0a9ff971 at rt.rs:59 [opt]
    frame #21: 0x0000000100016cfc compute`std::panicking::try::do_call::h7faedbe63ef0ecf9 at panicking.rs:306 [opt]
    frame #22: 0x0000000100027b4f compute`__rust_maybe_catch_panic at lib.rs:102 [opt]
    frame #23: 0x0000000100014cf8 compute`std::rt::lang_start_internal::hbde0134cdd993de4 [inlined] std::panicking::try::h66d036c9b5e0ac3f at panicking.rs:285 [opt]
    frame #24: 0x0000000100014cc5 compute`std::rt::lang_start_internal::hbde0134cdd993de4 [inlined] std::panic::catch_unwind::hdc6db1d58a689477 at panic.rs:361 [opt]
    frame #25: 0x0000000100014cc5 compute`std::rt::lang_start_internal::hbde0134cdd993de4 at rt.rs:58 [opt]
    frame #26: 0x0000000100002e02 compute`std::rt::lang_start::he2ae847addd0cd4a(main=&0x100005050, argc=1, argv=&0x7ffeefbff8a0) at rt.rs:74
    frame #27: 0x0000000100005d25 compute`main + 37
    frame #28: 0x00007fff6fd39115 libdyld.dylib`start + 1
(lldb) ^D

alexbool@alexbool-osx ~/D/I/metal-rs> rustc -vV
rustc 1.27.0-nightly (fb44b4c0e 2018-04-04)
binary: rustc
commit-hash: fb44b4c0eb1d344f84f7bb2c90f28e31a8a180be
commit-date: 2018-04-04
host: x86_64-apple-darwin
release: 1.27.0-nightly
LLVM version: 6.0

Still works on stable (1.25.0). I think this is rust issue, but cannot figure it out.

@kvark kvark added the bug label Apr 5, 2018
@alecmocatta
Copy link

My similar backtrace from vulkano-examples triangle example:

0   triangle                      	0x00000001009ec7da alloc_system::platform::_$LT$impl$u20$alloc..allocator..Alloc$u20$for$u20$$RF$$u27$a$u20$alloc_system..System$GT$::oom::h7ba03423480c6435 + 90 (lib.rs:210)
1   triangle                      	0x00000001009ec778 _$LT$alloc_system..System$u20$as$u20$alloc..allocator..Alloc$GT$::oom::h1cf7c566a518ba1a + 40 (lib.rs:81)
2   triangle                      	0x00000001009c535c __rde_oom + 44 (lib.rs:126)
3   triangle                      	0x00000001009b80d9 _$LT$alloc..heap..Heap$u20$as$u20$alloc..allocator..Alloc$GT$::oom::h3685bc2cb5516d9c + 9 (heap.rs:98)
4   triangle                      	0x00000001009b80c3 _$LT$alloc..raw_vec..RawVec$LT$T$C$$u20$A$GT$$GT$::reserve::h9f053b2c575fd046 + 339 (raw_vec.rs:557)
5   triangle                      	0x00000001009b155f _$LT$core..fmt..Write..write_fmt..Adapter$LT$$u27$a$C$$u20$T$GT$$u20$as$u20$core..fmt..Write$GT$::write_str::h1d32baed33c7429b + 31 (mod.rs:214)
6   triangle                      	0x00000001008f94c2 _$LT$alloc..string..String$u20$as$u20$core..fmt..Display$GT$::fmt::h8e8ee9dc63e63bfb + 50 (string.rs:1836)
7   triangle                      	0x00000001008fcfd8 _$LT$objc..message..MessageError$u20$as$u20$core..fmt..Display$GT$::fmt::hc4da75ee8325b1eb + 40 (mod.rs:157)
8   triangle                      	0x00000001009f29c9 core::fmt::write::hef443c0bb15170fe + 601 (mod.rs:1035)
9   triangle                      	0x00000001009b2234 std::panicking::begin_panic_fmt::hc0d47fefde30b0eb + 116 (panicking.rs:349)
10  triangle                      	0x00000001008c77fd metal_rs::CoreAnimationLayerRef::set_presents_with_transaction::hbaf562b3f4356cce + 509 (lib.rs:306)

It seems the objc send is failing, returning an undefined MessageError which on display in the panic!() tries to allocate a huge vec. My guess it it's due to SSheldon/rust-objc#62.

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

No branches or pull requests

3 participants