PoolBox: Counter != 1 on drop 0
JakkuSakura opened this issue · 1 comments
JakkuSakura commented
I'm on different threads, passing ArenaBox<FixBuffer>
created by Arena
. Not sure why whould this happen. It happens sometimes
#[repr(C)]
pub struct FixedBuffer {
len: usize,
content: [u8; 256],
}
impl FixedBuffer {
pub fn new() -> FixedBuffer {
unsafe {
FixedBuffer {
content: MaybeUninit::uninit().assume_init(),
len: 0,
}
}
}
}
impl Default for FixedBuffer {
fn default() -> Self {
FixedBuffer::new()
}
}
panic: thread 'unnamed' panicked at 'PoolBox: Counter != 1 on drop 0': /home/ubuntu/.cargo/registry/src/github.com-1ecc6299db9ec823/shared_arena-0.8.4/src/arena_box.rs:151
0: log_panics::init::{{closure}}
1: std::panicking::rust_panic_with_hook
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:626:17
2: std::panicking::begin_panic_handler::{{closure}}
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:519:13
3: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys_common/backtrace.rs:141:18
4: rust_begin_unwind
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:515:5
5: std::panicking::begin_panic_fmt
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/panicking.rs:457:5
6: <shared_arena::arena_box::ArenaBox<T> as core::ops::drop::Drop>::drop
7: <public_api::api_controller::imp::PublicApiControllerWorkImpl<Api,Buffer0> as public_api::api_controller::PublicApiControllerWork>::process_work
8: std::sys_common::backtrace::__rust_begin_short_backtrace
9: core::ops::function::FnOnce::call_once{{vtable.shim}}
10: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/alloc/src/boxed.rs:1575:9
<alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/alloc/src/boxed.rs:1575:9
std::sys::unix::thread::Thread::new::thread_start
at /rustc/c1e8f3a5857c3c8d095fd212acc6ed442f4cc58b/library/std/src/sys/unix/thread.rs:71:17
11: start_thread
12: <unknown>
JakkuSakura commented
It turns out my RingBuffer is unsafe when overflowing. It caused this problem.