Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GooseMetrics::print panics when using --no-task-metrics since version 0.13.1 #352

Closed
cppforliving opened this issue Aug 25, 2021 · 2 comments · Fixed by #353
Closed

GooseMetrics::print panics when using --no-task-metrics since version 0.13.1 #352

cppforliving opened this issue Aug 25, 2021 · 2 comments · Fixed by #353
Labels
bug Something isn't working

Comments

@cppforliving
Copy link

Minimal example to reproduce the issue

Cargo.toml

[package]
name = "goose-panic"
version = "0.1.0"
edition = "2018"

[dependencies]
goose = "=0.13.1"

src/main.rs

use goose::prelude::*;

fn main() -> Result<(), GooseError> {
    GooseAttack::initialize()?
        .register_taskset(taskset!("no-op"))
        .execute()?
        .print();
    Ok(())
}

Without --no-task-metrics there is no panic

$ RUST_BACKTRACE=1 cargo run -- --host http://localhost -t 1
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/goose-panic --host 'http://localhost' -t 1`

 === PER TASK METRICS ===
 ------------------------------------------------------------------------------
 Name                     |   # times run |        # fails |   task/s |  fail/s
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------
 Name                     |    Avg (ms) |        Min |         Max |     Median
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------
 Slowest page load within specified percentile of requests (in ms):
 ------------------------------------------------------------------------------
 Name                     |    50% |    75% |    98% |    99% |  99.9% | 99.99%
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------
 Users: 1
 Target host: http://localhost/
 During: 2021-08-25 13:45:01 - 2021-08-25 13:45:02 (duration: 00:00:01)

 goose v0.13.1
 ------------------------------------------------------------------------------

However adding --no-task-metrics causes GooseMetrics::print panic

$ RUST_BACKTRACE=1 cargo run -- --host http://localhost -t 1 --no-task-metrics
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
     Running `target/debug/goose-panic --host 'http://localhost' -t 1 --no-task-metrics`
 ------------------------------------------------------------------------------
 Slowest page load within specified percentile of requests (in ms):
 ------------------------------------------------------------------------------
 Name                     |    50% |    75% |    98% |    99% |  99.9% | 99.99%
 ------------------------------------------------------------------------------
 ------------------------------------------------------------------------------
 Users: 1
thread 'main' panicked at 'internal error: entered unreachable code', /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/goose-0.13.1/src/metrics.rs:2051:17
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:92:14
   2: core::panicking::panic
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/panicking.rs:50:5
   3: goose::metrics::GooseMetrics::fmt_overview
             at /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/goose-0.13.1/src/metrics.rs:2051:17
   4: <goose::metrics::GooseMetrics as core::fmt::Display>::fmt
             at /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/goose-0.13.1/src/metrics.rs:2128:9
   5: <&T as core::fmt::Display>::fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/fmt/mod.rs:2031:62
   6: core::fmt::write
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/fmt/mod.rs:1110:17
   7: std::io::Write::write_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/io/mod.rs:1588:15
   8: <&std::io::stdio::Stdout as std::io::Write>::write_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/io/stdio.rs:657:9
   9: <std::io::stdio::Stdout as std::io::Write>::write_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/io/stdio.rs:631:9
  10: std::io::stdio::print_to
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/io/stdio.rs:934:21
  11: std::io::stdio::_print
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/std/src/io/stdio.rs:947:5
  12: goose::metrics::GooseMetrics::print
             at /home/builder/.cargo/registry/src/github.com-1ecc6299db9ec823/goose-0.13.1/src/metrics.rs:944:13
  13: goose_panic::main
             at ./src/main.rs:4:5
  14: core::ops::function::FnOnce::call_once
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

When using older version 0.13.0, the panic does not happen.

@jeremyandrews jeremyandrews added the bug Something isn't working label Aug 25, 2021
@jeremyandrews
Copy link
Member

Thanks for the bug report! I can duplicate, and will be sure this is fixed in the next release.

@cppforliving
Copy link
Author

Thank you for such a quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants