tag1consulting / goose

Load testing framework, inspired by Locust
https://tag1.com/goose
Apache License 2.0
799 stars 71 forks source link

Goose hangs in the exiting phase #582

Open lvn-ruby-dragon opened 7 months ago

lvn-ruby-dragon commented 7 months ago

I have the following setup ...

pub(crate) async fn transaction1(user: &mut GooseUser) -> TransactionResult {
    user.client = Client::builder()
        .http1_only()
        .trust_dns(true)
        .build()
        .expect("Client creation failed");

    let request_builder = user
        .get_request_builder(&GooseMethod::Get, "/endpoint1")?
        .version(reqwest::Version::HTTP_11);

    let goose_request = GooseRequest::builder()
        .set_request_builder(request_builder)
        .build();

    let validation = &Validate::builder().status(200).build();

    let goose = user.request(goose_request).await?;

    validate_page(user, goose, validation).await?;

    Ok(())
}

pub(crate) async fn transaction2(user: &mut GooseUser) -> TransactionResult {
    user.client = Client::builder()
        .http1_only()
        .trust_dns(true)
        .build()
        .expect("Client creation failed");

    let request_builder = user
        .get_request_builder(&GooseMethod::Get, "/endpoint2")?
        .version(reqwest::Version::HTTP_11);

    let goose_request = GooseRequest::builder()
        .set_request_builder(request_builder)
        .build();

    let validation = &Validate::builder().status(200).build();

    let goose = user.request(goose_request).await?;

    validate_page(user, goose, validation).await?;

    Ok(())
}

pub(crate) async fn transaction3(user: &mut GooseUser) -> TransactionResult {
    user.client = Client::builder()
        .http1_only()
        .trust_dns(true)
        .build()
        .expect("Client creation failed");

    let request_builder = user
        .get_request_builder(&GooseMethod::Get, "/endpoint3")?
        .version(reqwest::Version::HTTP_11);

    let goose_request = GooseRequest::builder()
        .set_request_builder(request_builder)
        .build();

    let validation = &Validate::builder().status(200).build();

    let goose = user.request(goose_request).await?;

    validate_page(user, goose, validation).await?;

    Ok(())
}

#[tokio::main]
async fn main() -> Result<(), GooseError> {
    GooseAttack::initialize()?
        .register_scenario(
            scenario!("scenario1").register_transaction(transaction!(transaction1).set_name("tx1")),
        )
        .register_scenario(
            scenario!("scenario2")
                .register_transaction(transaction!(transaction2).set_name("tx2"))
                .register_transaction(transaction!(transaction2).set_name("tx3"))
        )
        .execute()
        .await?;

  Ok(())
}

I have 5 scenarios with a total of some 30 transactions. When I build the binary:

$ cargo build --release --target=x86_64-unknown-linux-musl

and ship the binary onto a testing machine and run it like this:

./goose-test --users 100 --startup-time 100s --host MY_HOST --report-file=report.html --run-time 2m

It successfully goes through the launching and maintain phase and then pretty much always gets stuck on exiting one of the users:

exiting user 3 from SOME_SCENARIO...

Never finishes and never produces the report. Do you see anything I'm doing wrong, please?

jeremyandrews commented 2 months ago

Sorry for not responding to this. Is this still an issue? Were you ever able to track down what was going wrong? Nothing is immediately obvious, but I'd enable some logging to try and better understand what's happening. https://book.goose.rs/logging/overview.html

psibi commented 2 months ago

I faced similar issue and I had to use this commit as an workaround for fixing it: https://github.com/psibi/goose/commit/16ea83419a8008573d3734e4c7affdd68a9eb02d

Unfortunately that's just an workaround and I was able to get the final output with that change.

jeremyandrews commented 2 months ago

Then the solution is rolling a new release. I’m traveling internationally this week, I’ll aim to roll a new release next week. It’s way past due.

psibi commented 2 months ago

Thanks! Is this bug fixed in the upcoming new release ? Curious to know more about the details of this bug.