Open fansehep opened 2 months ago
I switch the rustc to stable, it will be ok. :(
i have the same case, just call open_default, and then panic.
std::ptr::copy_nonoverlapping(ptr, vec.as_mut_ptr(), cnt); the ptr parameter is NULL, so it will panic
Same, but only during tests
I Have the same issue
unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments
are aligned and non-null and the specified memory ranges do not overlap
any idea why this happens?
It only happens with
rustc 1.78.0 AND 1.80.0-nightly
but not
rustc 1.75.0
Testing with :
rocksdb = "0.22.0" AND 0.21.0
let mut opts = Options::default();
opts.create_if_missing(true);
let txn_db_opts = TransactionDBOptions::default();
let db = TransactionDB::open(&opts, &txn_db_opts, db_path).unwrap();
0: rust_begin_unwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
1: core::panicking::panic_nounwind_fmt::runtime
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:110:18
2: core::panicking::panic_nounwind_fmt
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:123:9
3: core::panicking::panic_nounwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:156:5
4: core::intrinsics::copy_nonoverlapping::precondition_check
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/intrinsics.rs:2799:21
5: core::intrinsics::copy_nonoverlapping
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/intrinsics.rs:2969:5
6: rocksdb::transactions::transaction_db::TransactionDB<T>::open_cf_descriptors_internal
at /home/lisak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rocksdb-0.22.0/src/transactions/transaction_db.rs:303:13
7: rocksdb::transactions::transaction_db::TransactionDB<T>::open_cf
at /home/lisak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rocksdb-0.22.0/src/transactions/transaction_db.rs:200:9
8: rocksdb::transactions::transaction_db::TransactionDB<T>::open
at /home/lisak/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rocksdb-0.22.0/src/transactions/transaction_db.rs:179:9
9: index_btc::merkle::AddressIndexer::new
Workaround:
rocksdb = { git = "https://github.com/rust-rocksdb/rust-rocksdb", rev = "1cf906dc4087f06631820f13855e6b27bd21b972" }
The other commits between 0.22.0 and that one are very minor.
panic in 1.79.0
release version may not panic
This commit on master branch have fixed this issue https://github.com/rust-rocksdb/rust-rocksdb/commit/1cf906dc4087f06631820f13855e6b27bd21b972
This demo in my laptop, it will panic.
output:
I'm confused about this.