Skip to content

src/rt/object.rs: index out of bounds: the len is 0 but the index is [number-bigger-than-0] #399

@vincent-thomas

Description

@vincent-thomas

NOTE: This library where this loom bug lies, is a low level library and this currently can only be reproduced on macos.

On every test I use loom::model on this panic shows up.

Example errors:

    thread 'test_accept_ipv6' panicked at /Users/vt/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/loom-0.7.2/src/rt/object.rs:382:50:
    index out of bounds: the len is 0 but the index is 4
    stack backtrace:
       0: __rustc::rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::panicking::panic_bounds_check
       3: loom::rt::object::Ref<T>::set_action
       4: scoped_tls::ScopedKey<T>::with
       5: loom::rt::atomic::Atomic<T>::rmw
       6: loom::sync::atomic::int::AtomicU64::fetch_add
       7: lio::driver::Driver::reserve_driver_entry
       8: lio::accept
       9: <tokio::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll
      10: <core::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
      11: test_accept::test_accept_ipv6::{{closure}}::{{closure}}
      12: tokio::runtime::scheduler::current_thread::Context::enter
      13: tokio::runtime::context::scoped::Scoped<T>::set
      14: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
      15: tokio::runtime::context::runtime::enter_runtime
      16: lio::loom::test_utils::block_on
      17: core::ops::function::FnOnce::call_once{{vtable.shim}}
      18: generator::stack::StackBox<F>::call_once
      19: generator::detail::gen::gen_init_impl
      20: generator::detail::asm::gen_init
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

        FAIL [   2.440s] lio::test_accept test_accept_concurrent
  stdout ───

    running 1 test
    ERROR generator::detail::gen: set panic inside generator
    test test_accept_concurrent ... FAILED

    failures:

    failures:
        test_accept_concurrent

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 4 filtered out; finished in 2.43s

  stderr ───

    thread 'test_accept_concurrent' panicked at /Users/vt/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/loom-0.7.2/src/rt/object.rs:382:50:
    index out of bounds: the len is 0 but the index is 4
    stack backtrace:
       0: __rustc::rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::panicking::panic_bounds_check
       3: loom::rt::object::Ref<T>::set_action
       4: scoped_tls::ScopedKey<T>::with
       5: loom::rt::atomic::Atomic<T>::rmw
       6: loom::sync::atomic::int::AtomicU64::fetch_add
       7: lio::driver::Driver::reserve_driver_entry
       8: lio::accept
       9: <tokio::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll
      10: <core::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
      11: test_accept::test_accept_concurrent::{{closure}}::{{closure}}
      12: tokio::runtime::scheduler::current_thread::Context::enter
      13: tokio::runtime::context::scoped::Scoped<T>::set
      14: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
      15: tokio::runtime::context::runtime::enter_runtime
      16: lio::loom::test_utils::block_on
      17: core::ops::function::FnOnce::call_once{{vtable.shim}}
      18: generator::stack::StackBox<F>::call_once
      19: generator::detail::gen::gen_init_impl
      20: generator::detail::asm::gen_init
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

        FAIL [   4.259s] lio::test_accept test_accept_multiple
  stdout ───

    running 1 test
    ERROR generator::detail::gen: set panic inside generator
    test test_accept_multiple ... FAILED

    failures:

    failures:
        test_accept_multiple

    test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 4 filtered out; finished in 4.25s

  stderr ───

    thread 'test_accept_multiple' panicked at /Users/vt/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/loom-0.7.2/src/rt/object.rs:382:50:
    index out of bounds: the len is 0 but the index is 4
    stack backtrace:
       0: __rustc::rust_begin_unwind
       1: core::panicking::panic_fmt
       2: core::panicking::panic_bounds_check
       3: loom::rt::object::Ref<T>::set_action
       4: scoped_tls::ScopedKey<T>::with
       5: loom::rt::atomic::Atomic<T>::rmw
       6: loom::sync::atomic::int::AtomicU64::fetch_add
       7: lio::driver::Driver::reserve_driver_entry
       8: lio::accept
       9: <tokio::future::maybe_done::MaybeDone<Fut> as core::future::future::Future>::poll
      10: <core::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
      11: test_accept::test_accept_multiple::{{closure}}::{{closure}}
      12: tokio::runtime::scheduler::current_thread::Context::enter
      13: tokio::runtime::context::scoped::Scoped<T>::set
      14: tokio::runtime::scheduler::current_thread::CoreGuard::block_on
      15: tokio::runtime::context::runtime::enter_runtime
      16: lio::loom::test_utils::block_on
      17: core::ops::function::FnOnce::call_once{{vtable.shim}}
      18: generator::stack::StackBox<F>::call_once
      19: generator::detail::gen::gen_init_impl
      20: generator::detail::asm::gen_init
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace

Reproduce instructions:
(If some tests run for more than 5s then kill, they deadlock)

$ git clone https://github.com/liten-rs/liten
$ cd liten/lio
$ RUSTFLAGS="--cfg loom" RUST_BACKTRACE=1 cargo nextest r --release 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions