Closed ErichDonGubler closed 6 years ago
<threshold_crypto::SecretKey as core::ops::drop::Drop>::drop
in the stacktrace seems to be the culprit -- the panic message states 'Failed to drop `SecretKey`: Failed to `munlock` 32 bytes starting at address: 0x1aa0620
. Is this a hole in Windows support for threshold_crypto
?
Yes. Unfortunately we haven't been testing on Windows at all. You shouldn't have any problems on MinGW (though no promises). Linux is our only first-class platform for the moment. This is something that badly needs to be addressed.
@c0gent: In my report above I've noted that the target triple is stable-x86_64-pc-windows-gnu
-- msvc
doesn't even compile because unistd.h
is missing. So, this problem is happening specifically in the MinGW environment.
My mistake, I was on my phone and I missed that.
@ErichDonGubler, please retry with
MLOCK_SECRETS=false cargo test --release
as described in the README. Let know how it went.
@vkomenda: MLOCK_SECRETS=false
resolves my immediate issue (running tests), independent of the --release
flag. I have not found a way to work around the issue as originally reported, but thank you for the tip!
Does it work with test-threads=1
? I wonder whether too many pages get locked at the same time.
Maybe we should consider making MLOCK_SECRETS=false
the default until we have addressed this issue in general (see discussion in https://github.com/poanetwork/threshold_crypto/pull/34). I wonder whether it's worse on Windows (e.g. lower limit for locked pages, or a tendency to lock more pages because of different allocation).
@afck: This is the error output I'm getting trying to use cargo test --release --test-threads 1
:
$ cargo test --release -- --test-threads 1
Compiling hbbft v0.1.0 (file:///C:/msys64/home/K0RYU/workspace/interviews/poa-networks/hbbft)
Finished release [optimized] target(s) in 1m 42s
Running target\release\deps\hbbft-efd7f2c9ff217d71.exe
running 3 tests
test broadcast::merkle::tests::test_merkle ... ok
test dynamic_honey_badger::votes::tests::test_committed_votes ... FAILED
test dynamic_honey_badger::votes::tests::test_pending_votes ... FAILED
failures:
---- dynamic_honey_badger::votes::tests::test_committed_votes stdout ----
thread 'dynamic_honey_badger::votes::tests::test_committed_votes' panicked at 'Failed to drop `SecretKey`: Failed to `munlock` 32 bytes starting at address: 0xbdd70', C:\Users\K0RYU\.cargo\git\checkouts\threshold_crypto-3605c1a1492f376b\e1c9158\src\lib.rs:316:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.
---- dynamic_honey_badger::votes::tests::test_pending_votes stdout ----
thread 'dynamic_honey_badger::votes::tests::test_pending_votes' panicked at 'Failed to drop `SecretKey`: Failed to `munlock` 32 bytes starting at address: 0xbda10', C:\Users\K0RYU\.cargo\git\checkouts\threshold_crypto-3605c1a1492f376b\e1c9158\src\lib.rs:316:13
failures:
dynamic_honey_badger::votes::tests::test_committed_votes
dynamic_honey_badger::votes::tests::test_pending_votes
test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out
error: test failed, to rerun pass '--lib'
All mlock/munlock code has been removed from threshold_crypto for now. We have https://github.com/poanetwork/threshold_crypto/issues/24 and related issues to add it back in in the future, but this time with a dedicated allocator to avoid these kinds of problems.
(Please reopen if you can still reproduce the panic with current master.)
For some reason tests inside of
src/dynamic_honey_badger/votes.rs
are throwing panics inside of panics. This causes an immediate abort, and blocks tests from running. This seems specific to my Windows 10 machine, sincemaster
seems to pass just fine in Travis (a *nix environment).Output of
cargo test
:Output of
rustup show
:**Output of `RUST_BACKTRACE=1 cargo test` in MSYS2 environment**
``` ~/…/pull-requests/hbbft master$ RUST_BACKTRACE=1 cargo test Finished dev [unoptimized + debuginfo] target(s) in 0.57s Running target\debug\deps\hbbft-0cddedd180c2030e.exe running 3 tests test broadcast::merkle::tests::test_merkle ... ok test dynamic_honey_badger::votes::tests::test_committed_votes ... FAILED test dynamic_honey_badger::votes::tests::test_pending_votes ... FAILED failures: ---- dynamic_honey_badger::votes::tests::test_committed_votes stdout ---- thread 'dynamic_honey_badger::votes::tests::test_committed_votes' panicked at 'Failed to drop `SecretKey`: Failed to `munlock` 32 bytes starting at address: 0x1a90c30', C:\Users\egubler\.cargo\git\checkouts\threshold_crypto-3605c1a1492f376b\02109b5\src\lib.rs:308:13 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. stack backtrace: 0: std::sys::windows::backtrace::unwind_backtrace at libstd\sys\windows\backtrace/mod.rs:104 at libstd\sys\windows\backtrace/mod.rs:91 1: std::sys_common::backtrace::print at libstd\sys_common/backtrace.rs:71 at libstd\sys_common/backtrace.rs:59 2: std::panicking::default_hook::{{closure}} at libstd/panicking.rs:211 3: std::panicking::default_hook at libstd/panicking.rs:221 4: std::panicking::rust_panic_with_hook at libstd/panicking.rs:475 5: std::panicking::continue_panic_fmt at libstd/panicking.rs:390 6: std::panicking::begin_panic_fmt at libstd/panicking.rs:345 7:If there's any other information I can provide to you, please let me know!