-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Closed
Description
use https://github.com/rust-rocksdb/rust-rocksdb
Expected behavior
no err
Actual behavior
pthread lock: Invalid argument
Steps to reproduce the behavior
just cargo run
main.rs
use std::sync::mpsc::{channel, Sender};
use rocksdb::DB;
fn main() {
let tx = open_client();
tx.send("sss".to_string()).unwrap();
}
fn open_client() -> Sender<String> {
let dir = std::env::temp_dir().join("db");
let db = DB::open_default(&dir).unwrap();
let (tx, rx) = channel();
std::thread::spawn(move || {
while let Ok(k) = rx.recv() {
if let Some(data) = db.get(k).unwrap() {
println!("xxxx: {}", String::from_utf8_lossy(&data));
}
}
});
tx
}
Cargo.toml
[dependencies]
rocksdb = "0.20.1"
(gdb) b rocksdb/port/port_posix.cc:54
(gdb) run
Thread 20 "db" hit Breakpoint 6, rocksdb::port::PthreadCall (label=0x555555d58a0e "lock", result=22) at rocksdb/port/port_posix.cc:54
54 abort();
(gdb) bt
#0 rocksdb::port::PthreadCall (label=0x555555d58a0e "lock", result=22) at rocksdb/port/port_posix.cc:54
#1 0x0000555555924124 in rocksdb::port::Mutex::Lock (this=0x5555560177a8 <rocksdb::PeriodicTaskScheduler::Default()::timer+8>) at rocksdb/port/port_posix.cc:80
#2 0x00005555558b49c2 in rocksdb::InstrumentedMutex::LockInternal (this=0x5555560177a8 <rocksdb::PeriodicTaskScheduler::Default()::timer+8>)
at rocksdb/monitoring/instrumented_mutex.cc:55
#3 0x00005555558b4978 in rocksdb::InstrumentedMutex::Lock (this=0x5555560177a8 <rocksdb::PeriodicTaskScheduler::Default()::timer+8>) at rocksdb/monitoring/instrumented_mutex.cc:31
#4 0x00005555556098ec in rocksdb::InstrumentedMutexLock::InstrumentedMutexLock (this=0x7fffe3ff58c8, mutex=0x5555560177a8 <rocksdb::PeriodicTaskScheduler::Default()::timer+8>)
at rocksdb/monitoring/instrumented_mutex.h:74
#5 0x000055555578958e in rocksdb::Timer::Cancel (this=0x5555560177a0 <rocksdb::PeriodicTaskScheduler::Default()::timer>, fn_name="dump_st0") at rocksdb/util/timer.h:86
#6 0x000055555578a644 in rocksdb::PeriodicTaskScheduler::Unregister (this=0x555556067368, task_type=rocksdb::PeriodicTaskType::kDumpStats) at rocksdb/db/periodic_task_scheduler.cc:88
#7 0x000055555561595a in rocksdb::DBImpl::CancelAllBackgroundWork (this=0x555556065c40, wait=false) at rocksdb/db/db_impl/db_impl.cc:503
#8 0x0000555555615f7d in rocksdb::DBImpl::CloseHelper (this=0x555556065c40) at rocksdb/db/db_impl/db_impl.cc:575
#9 0x0000555555616d81 in rocksdb::DBImpl::CloseImpl (this=0x555556065c40) at rocksdb/db/db_impl/db_impl.cc:743
#10 0x0000555555616e33 in rocksdb::DBImpl::~DBImpl (this=0x555556065c40, __in_chrg=<optimized out>) at rocksdb/db/db_impl/db_impl.cc:761
#11 0x00005555556176c4 in rocksdb::DBImpl::~DBImpl (this=0x555556065c40, __in_chrg=<optimized out>) at rocksdb/db/db_impl/db_impl.cc:763
#12 0x00005555555f27b6 in rocksdb_close (db=0x55555608bc90) at rocksdb/db/c.cc:852
#13 0x00005555555e477e in <rocksdb::db::DBWithThreadModeInner as core::ops::drop::Drop>::drop (self=0x7fffe3ff61c8) at src/db.rs:290
#14 0x00005555555bcf6b in core::ptr::drop_in_place<rocksdb::db::DBWithThreadModeInner> () at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ptr/mod.rs:490
#15 0x00005555555bc49b in core::ptr::drop_in_place<rocksdb::db::DBCommon<rocksdb::db::SingleThreaded,rocksdb::db::DBWithThreadModeInner>> ()
at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ptr/mod.rs:490
#16 0x00005555555bd49f in core::ptr::drop_in_place<db::open_client::{{closure}}> () at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ptr/mod.rs:490
#17 0x00005555555d16e5 in db::open_client::{{closure}} () at src/main.rs:21
#18 0x00005555555a7143 in std::sys_common::backtrace::__rust_begin_short_backtrace (f=...) at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/sys_common/backtrace.rs:121
#19 0x00005555555acbe0 in std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}} () at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/thread/mod.rs:558
#20 0x00005555555d5e30 in <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once (self=..., _args=())
at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/panic/unwind_safe.rs:271
#21 0x00005555555ab6ad in std::panicking::try::do_call (data=0x7fffe3ff6590 "\220\274\bVUU") at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:483
#22 0x00005555555ab8eb in __rust_try () at library/core/src/panicking.rs:212
#23 0x00005555555ab4f6 in std::panicking::try (f=...) at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panicking.rs:447
#24 0x00005555555cde70 in std::panic::catch_unwind (f=...) at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/panic.rs:140
#25 0x00005555555ac9b6 in std::thread::Builder::spawn_unchecked_::{{closure}} () at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/std/src/thread/mod.rs:557
#26 0x00005555555bc07e in core::ops::function::FnOnce::call_once{{vtable-shim}} () at /rustc/2c8cc343237b8f7d5a3c3703e3a87f2eb2c54a74/library/core/src/ops/function.rs:250
#27 0x0000555555d18cf3 in <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once () at library/alloc/src/boxed.rs:1988
#28 <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once () at library/alloc/src/boxed.rs:1988
#29 std::sys::unix::thread::Thread::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#30 0x00007ffff7df5f3b in ?? () from /usr/lib64/libpthread.so.0
#31 0x00007ffff7ba3570 in clone () from /usr/lib64/libc.so.6
Metadata
Metadata
Assignees
Labels
No labels
