spacejam / rio

pure rust io_uring library, built on libc, thread & async friendly, misuse resistant

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic when using submit_all and Completion::wait

Geal opened this issue · comments

with the following code:

fn main() -> io::Result<()> {
  let ring = rio::new()?;
  let acceptor = TcpListener::bind("127.0.0.1:8080")?;
  let c1 = ring.accept(&acceptor);
  ring.submit_all();
  println!("c1: {:?}", c1.wait());
  Ok(())
}

I get the following panic trace:

thread 'main' panicked at 'failed to submit our expected SQE on ensure_submitted. expected old 0 + submitted 0 to be >= sqe_id 1', /home/geal/.cargo/registry/src/github.com-1ecc6299db9ec823/rio-0.9.2/src/io_uring/uring.rs:102:13          
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /home/geal/.cargo/registry/src/github.com-1ecc6299db9ec823/rio-0.9.2/src/io_uring/uring.rs:90:13
stack backtrace:                                                                                                       
   0:     0x55c1f8995dc8 - backtrace::backtrace::libunwind::trace::h86edaa2680be3f32                       
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1:     0x55c1f8995dc8 - backtrace::backtrace::trace_unsynchronized::h020717321cc60d9f                                                                                                                                                      
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2:     0x55c1f8995dc8 - std::sys_common::backtrace::_print_fmt::h95a740d649d8282b                                                                                                                                                          
                               at src/libstd/sys_common/backtrace.rs:77                                      
   3:     0x55c1f8995dc8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h229d12a248a94d4d
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x55c1f89b4e4c - core::fmt::write::h7a7c155a9a2fc994
                               at src/libcore/fmt/mod.rs:1052
   5:     0x55c1f8990867 - std::io::Write::write_fmt::hbc3e21ba137de707
                               at src/libstd/io/mod.rs:1428 
   6:     0x55c1f8998485 - std::sys_common::backtrace::_print::h8ecf04ab6aa60d02
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x55c1f8998485 - std::sys_common::backtrace::print::hbbeb2ccd67fe006e
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x55c1f8998485 - std::panicking::default_hook::{{closure}}::h30799abc567130ac
                               at src/libstd/panicking.rs:204
   9:     0x55c1f89981c6 - std::panicking::default_hook::h992fc24d479949ec
                               at src/libstd/panicking.rs:224
  10:     0x55c1f8998ae2 - std::panicking::rust_panic_with_hook::hd5c9bb7319c9d846
                               at src/libstd/panicking.rs:470
  11:     0x55c1f89986cb - rust_begin_unwind
                               at src/libstd/panicking.rs:378
  12:     0x55c1f89b36e1 - core::panicking::panic_fmt::hb5178b003b60d015
                               at src/libcore/panicking.rs:85                                                                                                                                                                                 
  13:     0x55c1f89b3503 - core::option::expect_none_failed::ha3a5581dc27ee7da
                               at src/libcore/option.rs:1199
  14:     0x55c1f895ec20 - core::result::Result<T,E>::unwrap::h128df1335a9895c2
                               at /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/libcore/result.rs:963
  15:     0x55c1f897f2ff - rio::io_uring::uring::Uring::ensure_submitted::h26a3d49f0b4273bd
                               at /home/geal/.cargo/registry/src/github.com-1ecc6299db9ec823/rio-0.9.2/src/io_uring/uring.rs:90
  16:     0x55c1f896584f - rio::completion::Completion<C>::wait_inner::hb9b19c50f41fdda3
                               at /home/geal/.cargo/registry/src/github.com-1ecc6299db9ec823/rio-0.9.2/src/completion.rs:88
  17:     0x55c1f8966189 - <rio::completion::Completion<C> as core::ops::drop::Drop>::drop::h52530162c3514f2d
                               at /home/geal/.cargo/registry/src/github.com-1ecc6299db9ec823/rio-0.9.2/src/completion.rs:108
  18:     0x55c1f8962215 - core::ptr::drop_in_place::hb39ddc4a50cec2ea
                               at /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/libcore/ptr/mod.rs:174
  19:     0x55c1f895aeb8 - rio::completion::Completion<C>::wait::h27ed660e57b425e5
                               at /home/geal/.cargo/registry/src/github.com-1ecc6299db9ec823/rio-0.9.2/src/completion.rs:76
  20:     0x55c1f895b321 - rio_test::main::he690bc1d1ba0d878
                               at src/main.rs:45
  21:     0x55c1f895afb5 - std::rt::lang_start::{{closure}}::hc8053d381934b416
                               at /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/libstd/rt.rs:67
  22:     0x55c1f89985a3 - std::rt::lang_start_internal::{{closure}}::h35e485e19663c96e
                               at src/libstd/rt.rs:52
  23:     0x55c1f89985a3 - std::panicking::try::do_call::h00ecf8f872707631
                               at src/libstd/panicking.rs:303
  24:     0x55c1f899bb67 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  25:     0x55c1f8998f89 - std::panicking::try::h3f84bc59b258dd0b
                               at src/libstd/panicking.rs:281
  26:     0x55c1f8998f89 - std::panic::catch_unwind::hd5737c3ccacd68f7
                               at src/libstd/panic.rs:394
  27:     0x55c1f8998f89 - std::rt::lang_start_internal::h0b1b741f79488fca                           
                               at src/libstd/rt.rs:51                                                                  
  28:     0x55c1f895af89 - std::rt::lang_start::h9ae5b092ac55de00
                               at /rustc/58b834344fc7b9185e7a50db1ff24e5eb07dae5e/src/libstd/rt.rs:67
  29:     0x55c1f895b5aa - main                                                                                        
  30:     0x7fcf8b4d1153 - __libc_start_main       
  31:     0x55c1f895916e - _start                                                                                      
  32:                0x0 - <unknown>                                                                                   
thread panicked while panicking. aborting.                                                                             
sh : ligne 1 : 154044 Instruction non permise (core dumped)cargo run

and for good measure, it ends on a sigill :D

If I remove the submit_all line, it does not panic