algesten / ureq

A simple, safe HTTP client
Apache License 2.0
1.67k stars 173 forks source link

ureq 3.x Panic Incorrect state: Cleanup #787

Closed algesten closed 1 month ago

algesten commented 1 month ago

Running the 1000000 top sites test, we sometimes, very rarely get this panic:

[2024-08-15T00:32:00Z ERROR ureq::unit] Incorrect state: Cleanup
thread 'main' panicked at src/unit.rs:270:22:

The problem is to do with sending Input::Begin when unit is in the wrong state. The extract! below is what's failing.

            Input::Begin => {
                let flow = extract!(&mut self.state, State::Begin)
                    .expect("Input::Begin requires State::Begin");

                self.call_timings.time_call_start = Some(now);
                self.set_state(State::Prepare(flow));
            }