bheisler / cargo-criterion

Cargo extension for running Criterion.rs benchmarks
Apache License 2.0
186 stars 23 forks source link

Broken Pipe / Resource temporarily unavailable #12

Closed Heychsea closed 3 years ago

Heychsea commented 4 years ago

Hello,

When running cargo criterion it compiles fine but immediately gives me this error:

Error: Unable to open connection to bench target bron_kerbosch

Caused by:
    Resource temporarily unavailable (os error 35)
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })', /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/lib.rs:1437:13
stack backtrace:
   0:        0x10b013b0f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8ad47541fb823094
   1:        0x10b03c98e - core::fmt::write::he23e9bd6497f06c3
   2:        0x10b00e6c7 - std::io::Write::write_fmt::h91528f1131e6004e
   3:        0x10b0159ba - std::panicking::default_hook::{{closure}}::h1983f014a45a477e
   4:        0x10b0156fc - std::panicking::default_hook::hb0d9b93b5be8b120
   5:        0x10b015f88 - std::panicking::rust_panic_with_hook::h9f3faafe0983de5c
   6:        0x10b015b52 - rust_begin_unwind
   7:        0x10b05dc1f - core::panicking::panic_fmt::h0a2d1b3ca0b14316
   8:        0x10b05db25 - core::result::unwrap_failed::h71fe5d08237d0e52
   9:        0x10ae40576 - criterion::Criterion<M>::benchmark_group::ha490315f5602edbe
  10:        0x10ae4c62d - bron_kerbosch::seq::h54a8f4033907fcc9
  11:        0x10ae4ca90 - bron_kerbosch::main::hae67f97122857ce5
  12:        0x10ae48566 - std::rt::lang_start::{{closure}}::ha1ddb8b9e0daa0b0
  13:        0x10b0163b9 - std::rt::lang_start_internal::h795af50241e12334
  14:        0x10ae4cbe9 - main

On the other side, running cargo bench works perfectly.

I'm using cargo-criterion v1.0.0-alpha3 and criterion-rs v0.3.3 and I'm working on macOS 15.5.5.

bheisler commented 4 years ago

Hey, thanks for the bug report!

I'm pretty well stumped as to what might cause this, and I don't have a Mac available to experiment on. Here's what I can say, in case some mac user would like to help track this down:

cargo-criterion opens a non-blocking localhost listening socket and passes the port number to the benchmark in an environment variable. Criterion.rs benchmarks will detect that variable and open a connection (which I believe should be blocking in both directions?) to that socket, to exchange information about the benchmarks with cargo-criterion. When the socket is opened, there's a quick handshake to exchange information about the versions of the two sides. cargo-criterion sends a message first, then reads the response from Criterion.rs. This is all in src/connection.rs in both repos.

What happened here is that cargo-criterion was able to send its handshake message (or at least enough of it that Criterion.rs thought the connection was successfully opened) but then failed to read the response. Strangely, this doesn't seem to have produced any error message. Instead, the failure to open the connection was returned up to src/bench_target.rs, which reports the error up the call stack and eventually terminates the cargo-criterion process with the "Unable to open connection to bench target" error message. The panic backtrace is mostly a red herring - this is Criterion.rs thinking the connection was opened successfully and then failing to write to it later on.

I've pushed a branch which adds a bit of extra debug output to that code. Could you try installing from that branch:

cargo install --git https://github.com/bheisler/cargo-criterion.git --branch issue_12

And then running the following command to enable as much debug output as possible:

CRITERION_DEBUG=1 RUST_BACKTRACE=FULL cargo criterion --debug

That will enable cargo-criterion & Criterion.rs' internal debug output, full backtraces, and also compile the benchmarks in debug mode so that they give the complete backtrace with line numbers.

Heychsea commented 4 years ago

Thanks for investigating ! Unfortunately, the output does not seem to be really useful:

Debug output ``` 08:18:29 [INFO] Executing bron_kerbosch - "/Users/heychsea/Documents/Rust/graph-proto/target/debug/deps/bron_kerbosch-2a0450f129717ad7" 08:18:29 [DEBUG] (1) cargo_criterion::bench_target: Running '"/Users/heychsea/Documents/Rust/graph-proto/target/debug/deps/bron_kerbosch-2a0450f129717ad7" "--bench"' Error: Unable to open connection to bench target bron_kerbosch Caused by: 0: Failed to receive benchmark-hello message 1: Resource temporarily unavailable (os error 35) Criterion.rs DEBUG: Runner version: [1, 0, 0] thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })', /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/lib.rs:1437:13 stack backtrace: 0: 0x10a5314ff - backtrace::backtrace::libunwind::trace::hdff08984d375d02a at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 1: 0x10a5314ff - backtrace::backtrace::trace_unsynchronized::h1a393bcdfc10be62 at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 2: 0x10a5314ff - std::sys_common::backtrace::_print_fmt::h063c5f96b3f1deaf at src/libstd/sys_common/backtrace.rs:78 3: 0x10a5314ff - ::fmt::h8ad47541fb823094 at src/libstd/sys_common/backtrace.rs:59 4: 0x10a55a5ce - core::fmt::write::he23e9bd6497f06c3 at src/libcore/fmt/mod.rs:1069 5: 0x10a52bef7 - std::io::Write::write_fmt::h91528f1131e6004e at src/libstd/io/mod.rs:1504 6: 0x10a53356a - std::sys_common::backtrace::_print::ha16b452b57f4cc4c at src/libstd/sys_common/backtrace.rs:62 7: 0x10a53356a - std::sys_common::backtrace::print::hdcfe7b1cd849140e at src/libstd/sys_common/backtrace.rs:49 8: 0x10a53356a - std::panicking::default_hook::{{closure}}::h1983f014a45a477e at src/libstd/panicking.rs:198 9: 0x10a5332ac - std::panicking::default_hook::hb0d9b93b5be8b120 at src/libstd/panicking.rs:218 10: 0x10a533b38 - std::panicking::rust_panic_with_hook::h9f3faafe0983de5c at src/libstd/panicking.rs:511 11: 0x10a533702 - rust_begin_unwind at src/libstd/panicking.rs:419 12: 0x10a56de8f - core::panicking::panic_fmt::h0a2d1b3ca0b14316 13: 0x10a56dd95 - core::result::unwrap_failed::h71fe5d08237d0e52 14: 0x109f0aeb7 - core::result::Result::unwrap::h5d152e65de72fd91 at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/result.rs:1005 15: 0x109ed7502 - criterion::Criterion::benchmark_group::h04ca15f15d4ff0f7 at /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/lib.rs:1437 16: 0x109f049d8 - bron_kerbosch::seq::h00ff477123a6d269 at benches/bron_kerbosch.rs:50 17: 0x109f04fcd - bron_kerbosch::seq_small::h0f328d6aad0b23ac at benches/bron_kerbosch.rs:70 18: 0x109f05163 - bron_kerbosch::benches::hdf9755073dd2fc51 at /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/macros.rs:71 19: 0x109f051f0 - bron_kerbosch::main::h78f48a930b47a7a4 at /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/macros.rs:124 20: 0x109f0c39e - std::rt::lang_start::{{closure}}::h67d530a2f09e4f8f at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:67 21: 0x10a533f69 - std::rt::lang_start_internal::{{closure}}::hcd3fdb11e5e01a21 at src/libstd/rt.rs:52 22: 0x10a533f69 - std::panicking::try::do_call::hd8e8ada4e26d8788 at src/libstd/panicking.rs:331 23: 0x10a533f69 - std::panicking::try::hf951a93b7ea92f92 at src/libstd/panicking.rs:274 24: 0x10a533f69 - std::panic::catch_unwind::he82f6de4bcfc0f8c at src/libstd/panic.rs:394 25: 0x10a533f69 - std::rt::lang_start_internal::h795af50241e12334 at src/libstd/rt.rs:51 26: 0x109f0c381 - std::rt::lang_start::h410bf05594d441d5 at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:67 27: 0x109f05282 - main ```
Heychsea commented 4 years ago

Further research shows that error 35 is EAGAIN on macOS, and it happens when there is nothing to read yet. So the Connection::new method fails because there is nothing to read (happens only in non blocking mode).

Heychsea commented 4 years ago

On macOS, the non-blocking socket seems to give a lot of WouldBlock errors, I somehow managed to make it work a bit by protecting the reads but this does not protect everything and the socket is closed elsewhere :/ (And also, it seems extremely unoptimised)

loop {
    match socket.read_exact(&mut hello_buf) {
        Ok(_) => break,
        Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
        Err(e) => return Err(e).context("Unable to read from socket"),
    }
    std::thread::yield_now();
}
Output ``` ❯ cargo criterion --debug -- '^Sequential/small/1/BK-Basic$' Finished test [unoptimized + debuginfo] target(s) in 0.14s Benchmarking Sequential/small/1/BK-Basic: Warming up for 3.0000 s Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 43.4s, or reduce sample count to 10. Sequential/small/1/BK-Basic time: [406.51 ms 410.18 ms 414.11 ms] change: [-11.955% -10.257% -8.5448%] (p = 0.00 < 0.05) Performance has improved. thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Failed to send message Caused by: Resource temporarily unavailable (os error 35)', src/value_formatter.rs:41:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" })', /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/analysis/mod.rs:106:13 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Custom { kind: UnexpectedEof, error: "failed to fill whole buffer" })', /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/benchmark_group.rs:377:13 stack backtrace: 0: 0x10700e4ff - backtrace::backtrace::libunwind::trace::hdff08984d375d02a at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86 1: 0x10700e4ff - backtrace::backtrace::trace_unsynchronized::h1a393bcdfc10be62 at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66 2: 0x10700e4ff - std::sys_common::backtrace::_print_fmt::h063c5f96b3f1deaf at src/libstd/sys_common/backtrace.rs:78 3: 0x10700e4ff - ::fmt::h8ad47541fb823094 at src/libstd/sys_common/backtrace.rs:59 4: 0x1070375ce - core::fmt::write::he23e9bd6497f06c3 at src/libcore/fmt/mod.rs:1069 5: 0x107008ef7 - std::io::Write::write_fmt::h91528f1131e6004e at src/libstd/io/mod.rs:1504 6: 0x10701056a - std::sys_common::backtrace::_print::ha16b452b57f4cc4c at src/libstd/sys_common/backtrace.rs:62 7: 0x10701056a - std::sys_common::backtrace::print::hdcfe7b1cd849140e at src/libstd/sys_common/backtrace.rs:49 8: 0x10701056a - std::panicking::default_hook::{{closure}}::h1983f014a45a477e at src/libstd/panicking.rs:198 9: 0x1070102ac - std::panicking::default_hook::hb0d9b93b5be8b120 at src/libstd/panicking.rs:218 10: 0x107010b38 - std::panicking::rust_panic_with_hook::h9f3faafe0983de5c at src/libstd/panicking.rs:511 11: 0x107010702 - rust_begin_unwind at src/libstd/panicking.rs:419 12: 0x10704ae8f - core::panicking::panic_fmt::h0a2d1b3ca0b14316 13: 0x10704ad95 - core::result::unwrap_failed::h71fe5d08237d0e52 14: 0x1069e7eb7 - core::result::Result::unwrap::h5d152e65de72fd91 at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/result.rs:1005 15: 0x1069d1f5d - as core::ops::drop::Drop>::drop::h87f6806838289151 at /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/benchmark_group.rs:377 16: 0x1069d0d25 - core::ptr::drop_in_place::h365f56f6de59a2ad at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/ptr/mod.rs:177 17: 0x1069e1b4a - bron_kerbosch::seq::h00ff477123a6d269 at benches/bron_kerbosch.rs:55 18: 0x1069e1fcd - bron_kerbosch::seq_small::h0f328d6aad0b23ac at benches/bron_kerbosch.rs:70 19: 0x1069e2163 - bron_kerbosch::benches::hdf9755073dd2fc51 at /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/macros.rs:71 20: 0x1069e21f0 - bron_kerbosch::main::h78f48a930b47a7a4 at /Users/heychsea/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/macros.rs:124 21: 0x1069e939e - std::rt::lang_start::{{closure}}::h67d530a2f09e4f8f at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:67 22: 0x107010f69 - std::rt::lang_start_internal::{{closure}}::hcd3fdb11e5e01a21 at src/libstd/rt.rs:52 23: 0x107010f69 - std::panicking::try::do_call::hd8e8ada4e26d8788 at src/libstd/panicking.rs:331 24: 0x107010f69 - std::panicking::try::hf951a93b7ea92f92 at src/libstd/panicking.rs:274 25: 0x107010f69 - std::panic::catch_unwind::he82f6de4bcfc0f8c at src/libstd/panic.rs:394 26: 0x107010f69 - std::rt::lang_start_internal::h795af50241e12334 at src/libstd/rt.rs:51 27: 0x1069e9381 - std::rt::lang_start::h410bf05594d441d5 at /Users/heychsea/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:67 28: 0x1069e2282 - main thread panicked while panicking. aborting. ```

I hope this gives you enough insight into the issue. And thanks for looking into it.

bheisler commented 4 years ago

Hmm. I thought I had a reproducible test case for a crash very much like this, except it disappeared when I recompiled cargo-criterion. Even reinstalling the latest version from crates.io doesn't bring it back.

Very strange.

swiftcoder commented 3 years ago

I'm encountering this on a fresh setup with Mac OS 10.15.6, cargo-criterion 1.0.0-alpha3, criterion v0.3.3. Is there anything further I can do to help chase down the underlying issue?

Debug output ``` % RUST_BACKTRACE=full CRITERION_DEBUG=1 cargo criterion Compiling isosurface v0.0.4 (/Users/tristam/projects/rust/isosurface) Finished bench [optimized] target(s) in 1.97s 07:26:19 [INFO] Executing isosurface - "/Users/tristam/projects/rust/isosurface/target/release/deps/isosurface-2c9f9a590606eb28" 07:26:19 [DEBUG] (1) cargo_criterion::bench_target: Running '"/Users/tristam/projects/rust/isosurface/target/release/deps/isosurface-2c9f9a590606eb28" "--bench"' running 0 tests test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out 07:26:19 [INFO] Executing isosurface - "/Users/tristam/projects/rust/isosurface/target/release/deps/isosurface-3040ba4e0213e406" 07:26:19 [DEBUG] (1) cargo_criterion::bench_target: Running '"/Users/tristam/projects/rust/isosurface/target/release/deps/isosurface-3040ba4e0213e406" "--bench"' Criterion.rs DEBUG: Runner version: [1, 0, 0] Error: Unable to open connection to bench target isosurface Caused by: Resource temporarily unavailable (os error 35) Stack backtrace: 0: std::backtrace_rs::backtrace::libunwind::trace at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 std::backtrace_rs::backtrace::trace_unsynchronized at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 std::backtrace::Backtrace::create at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/backtrace.rs:316:13 1: std::backtrace::Backtrace::capture at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/backtrace.rs:284:9 2: cargo_criterion::connection::Connection::new 3: cargo_criterion::bench_target::BenchTarget::execute 4: cargo_criterion::main 5: std::sys_common::backtrace::__rust_begin_short_backtrace 6: std::rt::lang_start::{{closure}} 7: core::ops::function::impls:: for &F>::call_once at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/ops/function.rs:259:13 std::panicking::try::do_call at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:379:40 std::panicking::try at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:343:19 std::panic::catch_unwind at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panic.rs:396:14 std::rt::lang_start_internal at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/rt.rs:51:25 8: _main tristam@Tristams-MacBook-Pro isosurface % thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })', /Users/tristam/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.3.3/src/lib.rs:1438:18 stack backtrace: 0: 0x10e5a04d4 - std::backtrace_rs::backtrace::libunwind::trace::hd4e4f36eb9f0f866 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x10e5a04d4 - std::backtrace_rs::backtrace::trace_unsynchronized::hddd9cf7e61567951 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x10e5a04d4 - std::sys_common::backtrace::_print_fmt::hf0df20706c8d0efd at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:67:5 3: 0x10e5a04d4 - ::fmt::hddf67b5e68ee5eac at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:46:22 4: 0x10e5c3040 - core::fmt::write::hae6418d3f135b639 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/fmt/mod.rs:1078:17 5: 0x10e59b0d6 - std::io::Write::write_fmt::h822c37b1fbb805d3 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/io/mod.rs:1519:15 6: 0x10e5a23f9 - std::sys_common::backtrace::_print::hf8d765f57ebaea59 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:49:5 7: 0x10e5a23f9 - std::sys_common::backtrace::print::h4405042f17c9e5df at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:36:9 8: 0x10e5a23f9 - std::panicking::default_hook::{{closure}}::hb8c76ec6b2b5fec2 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:208:50 9: 0x10e5a1f80 - std::panicking::default_hook::h9520f36dd50be056 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:225:9 10: 0x10e5a2a7b - std::panicking::rust_panic_with_hook::hbb70e1d25c7381a9 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:591:17 11: 0x10e5a25a5 - std::panicking::begin_panic_handler::{{closure}}::hb72eee9aad2e147c at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:497:13 12: 0x10e5a0978 - std::sys_common::backtrace::__rust_end_short_backtrace::h372ff87ecb2667f3 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/sys_common/backtrace.rs:141:18 13: 0x10e5a250a - rust_begin_unwind at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:493:5 14: 0x10e5d898f - core::panicking::panic_fmt::h261fd45d36f74dfa at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/panicking.rs:92:14 15: 0x10e5d8895 - core::option::expect_none_failed::hf2a36714418ff407 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/option.rs:1268:5 16: 0x10e3be53b - criterion::Criterion::bench_function::h62a4757a80f13e2b 17: 0x10e3c8ee3 - isosurface::main::hbe32f8f1f642cb6c 18: 0x10e3b292a - std::sys_common::backtrace::__rust_begin_short_backtrace::heed8a8514d50f973 19: 0x10e3ba6cc - std::rt::lang_start::{{closure}}::h957fbb99146e98e8 20: 0x10e5a2ed4 - core::ops::function::impls:: for &F>::call_once::h4ab201f754b12ec0 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/core/src/ops/function.rs:259:13 21: 0x10e5a2ed4 - std::panicking::try::do_call::h2d40bab4a9c2dc4b at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:379:40 22: 0x10e5a2ed4 - std::panicking::try::he14232182da07291 at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panicking.rs:343:19 23: 0x10e5a2ed4 - std::panic::catch_unwind::ha032e0ba57e1000e at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/panic.rs:396:14 24: 0x10e5a2ed4 - std::rt::lang_start_internal::hebea83fb59fe572e at /rustc/1c389ffeff814726dec325f0f2b0c99107df2673/library/std/src/rt.rs:51:25 25: 0x10e3c8f79 - _main ```
inflation commented 3 years ago

Same issue on macOS 11.2.1 Big Sur with cargo-criterion 1.0.1 and criterion 0.3.4.

mhils commented 3 years ago

I don't want to make a "me too" comment, but it might be useful information that this also affects Windows 10:

Debug output
17:01:53 [INFO] Executing proxybench - "C:\\Users\\user\\git\\proxybench\\target\\release\\deps\\proxybench-59ddb8dd21410019.exe"
17:01:53 [DEBUG] (1) cargo_criterion::bench_target: Running '"C:\\Users\\user\\git\\proxybench\\target\\release\\deps\\proxybench-59ddb8dd21410019.exe" "--bench"'
Criterion.rs DEBUG: Runner version: [1, 0, 1]
Error: Unable to open connection to bench target proxybench

Caused by:
    Ein nicht blockierender Socketvorgang konnte nicht sofort ausgeführt werden. (os error 10035)

Gnuplot not found, using plotters backend
Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: BaseThreadInitThunk
  11: RtlUserThreadStart
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Os { code: 10053, kind: ConnectionAborted, message: "Eine bestehende Verbindung wurde softwaregesteuert\r\ndurch den Hostcomputer abgebrochen." })', C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\criterion-0.3.4\src\lib.rs:1105:18
stack backtrace:
   0:     0x7ff6ebda41fe - std::backtrace_rs::backtrace::dbghelp::trace
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\..\..\backtrace\src\backtrace\dbghelp.rs:98
   1:     0x7ff6ebda41fe - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff6ebda41fe - std::sys_common::backtrace::_print_fmt
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\sys_common\backtrace.rs:67
   3:     0x7ff6ebda41fe - std::sys_common::backtrace::_print::{{impl}}::fmt                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\sys_common\backtrace.rs:46
   4:     0x7ff6ebdc309b - core::fmt::write
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\core\src\fmt\mod.rs:1096
   5:     0x7ff6ebd9b618 - std::io::Write::write_fmt
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\io\mod.rs:1568
   6:     0x7ff6ebda6fdd - std::sys_common::backtrace::_print
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\sys_common\backtrace.rs:49
   7:     0x7ff6ebda6fdd - std::sys_common::backtrace::print
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\sys_common\backtrace.rs:36
   8:     0x7ff6ebda6fdd - std::panicking::default_hook::{{closure}}
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:208
   9:     0x7ff6ebda6aa9 - std::panicking::default_hook
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:225
  10:     0x7ff6ebda7890 - std::panicking::rust_panic_with_hook
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:591
  11:     0x7ff6ebda73c1 - std::panicking::begin_panic_handler::{{closure}}
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:497
  12:     0x7ff6ebda4b8f - std::sys_common::backtrace::__rust_end_short_backtrace
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\sys_common\backtrace.rs:141
  13:     0x7ff6ebda7319 - std::panicking::begin_panic_handler
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:493
  14:     0x7ff6ebdc1920 - core::panicking::panic_fmt
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\core\src\panicking.rs:92
  15:     0x7ff6ebdc1763 - core::option::expect_none_failed
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\core\src\option.rs:1300
  16:     0x7ff6eb97f9fa - criterion::Criterion::benchmark_group::hcc976a7395a1c914
  17:     0x7ff6eb9b9158 - hashbrown::raw::RawTable::insert::hb8725d1d91577b5c
  18:     0x7ff6eb9649f6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h735612a0fe897d28
  19:     0x7ff6eba309fc - std::rt::lang_start::{{closure}}::hc57f833c45c23b07
  20:     0x7ff6ebda7b67 - core::ops::function::impls::{{impl}}::call_once
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\library\core\src\ops\function.rs:280
  21:     0x7ff6ebda7b67 - std::panicking::try::do_call
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:379
  22:     0x7ff6ebda7b67 - std::panicking::try
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panicking.rs:343
  23:     0x7ff6ebda7b67 - std::panic::catch_unwind
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\panic.rs:431
  24:     0x7ff6ebda7b67 - std::rt::lang_start_internal
                               at /rustc/3f5aee2d5241139d808f4fdece0026603489afd1\/library\std\src\rt.rs:51
  25:     0x7ff6eb9b9667 - main
  26:     0x7ff6ebdd7a80 - invoke_main
                               at d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
  27:     0x7ff6ebdd7a80 - __scrt_common_main_seh
                               at d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
  28:     0x7ffc68a47034 - BaseThreadInitThunk
  29:     0x7ffc6a2dd241 - RtlUserThreadStart
yvt commented 3 years ago

This is probably overkill, but Tokio could be used to do the (non-)blocking I/Os correctly and fix this issue: https://github.com/yvt/cargo-criterion/commit/48f094fae8034b32fa47c0949ec530a82d501c54

I've been experimenting with something that talks with cargo-criterion, and cargo-criterion could never successfully connect to the target without this fix.

lemmih commented 3 years ago

Fixed in cargo-criterion-1.1.0.