Open rbtcollins opened 3 years ago
Note that I've only seen this once, and only when the test had failed :)
Hmm, interesting. The panic is occurring here: https://github.com/hawkw/sharded-slab/blob/cf2537f3a5bd6ea21e9e48ecc22f05522ca7821e/src/page/slot.rs#L718 where we are trying to decrement the number of outstanding references to a slot, but the number of references is zero.
I wonder if this is a race in the ref-counting logic, or if there's some kind of bug where a slot has already been cleared while a reference to it still exists.
Since the tests are from rustup, I'm assuming they're open-source...can I take a look at the test that triggers this?
This is close to the state I had the code when I triggered it - I had the test failing though, I'm going to see if I can recreate it for you. https://github.com/rbtcollins/rustup.rs/pull/new/sharded-slab-55
I can't seem to reproduce. We create several pools without customising the config, so we will have multiple references to the config object; and then this was unwinding a panic : I don't recall if the failing test was failing in a worker thread and propogating, or in the main thread.
We create several pools without customising the config, so we will have multiple references to the config object;
References to the config object shouldn't be an issue...this code runs when dropping a reference to an item in the pool...
This is from a unit test in rustup - I can push the branch up easily enough but basically: create several Arc\<pool>, add a Vec to one, downgrade, hand to a worker thread, panic in the main thread when the test fails.
backtrace
``` note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. thread 'diskio::test::test_complete_file_threaded' panicked at 'attempt to subtract with overflow', C:\Users\robertc\.cargo\registry\src\github.com-1ecc6299db9ec823\sharded-slab-0.1.1\src\page\slot.rs:718:26 stack backtrace: 0: 0x7ff6bd1c9c5e - std::backtrace_rs::backtrace::dbghelp::trace at /rustc/6a1835ad74247c069b0d24703c8267818487d7f5\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98 1: 0x7ff6bd1c9c5e - std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/6a1835ad74247c069b0d24703c8267818487d7f5\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66 2: 0x7ff6bd1c9c5e - std::sys_common::backtrace::_print_fmt at /rustc/6a1835ad74247c069b0d24703c8267818487d7f5\/library\std\src\sys_common\backtrace.rs:67 3: 0x7ff6bd1c9c5e - std::sys_common::backtrace::_print::{{impl}}::fmt at /rustc/6a1835ad74247c069b0d24703c8267818487d7f5\/library\std\src\sys_common\backtrace.rs:46 4: 0x7ff6bd1e790b - core::fmt::write at /rustc/6a1835ad74247c069b0d24703c8267818487d7f5\/library\core\src\fmt\mod.rs:1096 5: 0x7ff6bd1c3f88 - std::io::Write::write_fmt