Skip to content

Insert into Indexmap randomly fails #330

Closed
@SamJBarney

Description

@SamJBarney

Out of every 4 test runs I get the following error at least once:

thread 'block::block::tests::potential_block_states::retrieves_state_correctly' panicked at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\indexmap-2.2.6\src\map\core.rs:45:35:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0:     0x7ff73c49eaf8 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ff73c49eaf8 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66    
   2:     0x7ff73c49eaf8 - std::sys_common::backtrace::_print_fmt
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\sys_common\backtrace.rs:68
   3:     0x7ff73c49eaf8 - std::sys_common::backtrace::_print::impl$0::fmt
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\sys_common\backtrace.rs:44
   4:     0x7ff73c4bca59 - core::fmt::rt::Argument::fmt
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\fmt\rt.rs:165
   5:     0x7ff73c4bca59 - core::fmt::write
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\fmt\mod.rs:1157
   6:     0x7ff73c49afa1 - std::io::Write::write_fmt<alloc::vec::Vec<u8,alloc::alloc::Global> >
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\io\mod.rs:1832
   7:     0x7ff73c49e8d6 - std::sys_common::backtrace::print
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\sys_common\backtrace.rs:34
   8:     0x7ff73c4a10f8 - std::panicking::default_hook::closure$1
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:271
   9:     0x7ff73c4a0cdd - std::panicking::default_hook
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:295
  10:     0x7ff73c385e22 - alloc::boxed::impl$50::call
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\alloc\src\boxed.rs:2036
  11:     0x7ff73c385e22 - test::test_main::closure$0
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\test\src\lib.rs:137
  12:     0x7ff73c4a1657 - alloc::boxed::impl$50::call
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\alloc\src\boxed.rs:2036
  13:     0x7ff73c4a1657 - std::panicking::rust_panic_with_hook
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:799
  14:     0x7ff73c4a14e7 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:664
  15:     0x7ff73c49f46f - std::sys_common::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$> 
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\sys_common\backtrace.rs:171
  16:     0x7ff73c4a1198 - std::panicking::begin_panic_handler
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:652
  17:     0x7ff73c4ccb74 - core::panicking::panic_fmt
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panicking.rs:72
  18:     0x7ff73c4cccfe - core::panicking::panic_bounds_check
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panicking.rs:275
  19:     0x7ff73c330adc - indexmap::map::core::equivalent::closure$0<opencraft_api::util::resource_location::ResourceLocation,alloc::sync::Arc<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::alloc::Global>,opencraft_api::util::resource_location::Reso
                               at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\indexmap-2.2.6\src\map\core.rs:45      
  20:     0x7ff73c332297 - hashbrown::raw::inner::RawTableInner::find_or_find_insert_slot_inner
                               at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hashbrown-0.14.5\src\raw\mod.rs:1983   
  21:     0x7ff73c330c55 - indexmap::map::core::IndexMapCore<opencraft_api::util::resource_location::ResourceLocation,alloc::sync::Arc<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::alloc::Global> >::find_or_insert
                               at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\indexmap-2.2.6\src\map\core\raw.rs:67  
  22:     0x7ff73c330c55 - indexmap::map::core::IndexMapCore<opencraft_api::util::resource_location::ResourceLocation,alloc::sync::Arc<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::alloc::Global> >::insert_full<opencraft_api::util::resource_location
                               at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\indexmap-2.2.6\src\map\core.rs:338     
  23:     0x7ff73c3228aa - indexmap::map::IndexMap<opencraft_api::util::resource_location::ResourceLocation,alloc::sync::Arc<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::alloc::Global>,std::hash::random::RandomState>::insert_full
                               at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\indexmap-2.2.6\src\map.rs:415
  24:     0x7ff73c3228aa - indexmap::map::IndexMap<opencraft_api::util::resource_location::ResourceLocation,alloc::sync::Arc<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::alloc::Global>,std::hash::random::RandomState>::insert
                               at C:\Users\samjb\.cargo\registry\src\index.crates.io-6f17d22bba15001f\indexmap-2.2.6\src\map.rs:398
  25:     0x7ff73c3228aa - opencraft_api::registry::simple_registry::SimpleRegistry<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::sync::Arc<dyn$<opencraft_api::block::block_state::block_state_def::BlockStateDef>,alloc::alloc::Global> >::register<dyn
                               at C:\Users\samjb\Projects\Rust\opencraft-api\src\registry\simple_registry.rs:126
  26:     0x7ff73c33583d - opencraft_api::block::block::tests::setup_registry
                               at C:\Users\samjb\Projects\Rust\opencraft-api\src\block\block.rs:226
  27:     0x7ff73c3343df - opencraft_api::block::block::tests::potential_block_states::retrieves_state_correctly
                               at C:\Users\samjb\Projects\Rust\opencraft-api\src\block\block.rs:278
  28:     0x7ff73c32da0d - opencraft_api::block::block::tests::potential_block_states::retrieves_state_correctly::closure$0
                               at C:\Users\samjb\Projects\Rust\opencraft-api\src\block\block.rs:277
  29:     0x7ff73c32da0d - core::ops::function::FnOnce::call_once<opencraft_api::block::block::tests::potential_block_states::retrieves_state_correctly::closure_env$0,tuple$<> >
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081\library\core\src\ops\function.rs:250
  30:     0x7ff73c38c8c0 - core::ops::function::FnOnce::call_once
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\ops\function.rs:250
  31:     0x7ff73c38c8c0 - test::__rust_begin_short_backtrace<enum2$<core::result::Result<tuple$<>,alloc::string::String> >,enum2$<core::result::Result<tuple$<>,alloc::string::String> > (*)()>
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\test\src\lib.rs:623
  32:     0x7ff73c38b7e2 - test::run_test::closure$0
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\test\src\lib.rs:569
  33:     0x7ff73c34b7eb - test::run_test::closure$1
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\test\src\lib.rs:597
  34:     0x7ff73c34b7eb - std::sys_common::backtrace::__rust_begin_short_backtrace<test::run_test::closure_env$1,tuple$<> >
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\sys_common\backtrace.rs:155
  35:     0x7ff73c35117d - std::thread::impl$0::spawn_unchecked_::closure$2::closure$0
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\thread\mod.rs:542
  36:     0x7ff73c35117d - core::panic::unwind_safe::impl$25::call_once
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\panic\unwind_safe.rs:272
  37:     0x7ff73c35117d - std::panicking::try::do_call
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:559
  38:     0x7ff73c35117d - std::panicking::try
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panicking.rs:523
  39:     0x7ff73c35117d - std::panic::catch_unwind
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\panic.rs:149
  40:     0x7ff73c35117d - std::thread::impl$0::spawn_unchecked_::closure$2
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\thread\mod.rs:541
  41:     0x7ff73c35117d - core::ops::function::FnOnce::call_once<std::thread::impl$0::spawn_unchecked_::closure_env$2<test::run_test::closure_env$1,tuple$<> >,tuple$<> >
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\core\src\ops\function.rs:250
  42:     0x7ff73c4ac87d - alloc::boxed::impl$48::call_once
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\alloc\src\boxed.rs:2022
  43:     0x7ff73c4ac87d - alloc::boxed::impl$48::call_once
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\alloc\src\boxed.rs:2022
  44:     0x7ff73c4ac87d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library\std\src\sys\pal\windows\thread.rs:52
  45:     0x7ffd7f82257d - BaseThreadInitThunk
  46:     0x7ffd815aaf28 - RtlUserThreadStart

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