Open AndrejsK opened 10 hours ago
Excellent! Thanks!
I found the problem. Or rather a combo of problem.
https://github.com/algesten/ureq-proto/blob/main/src/body.rs#L155-L166
We end up in a situation where we think we can write another chunk, but can't because the overhead of the chunk is more than the hardcoded 5.
The solve will be to calculate the exact amount we can fit including overhead into the remaining output. However it is maybe a secondary problem. Because:
https://github.com/algesten/ureq/blob/main/src/run.rs#L419
We do not write the entire output in one big chunk, but rather have a default max chunk in ureq-proto which will cause n-loops x overhead. This means the exact overhead calculation is totally off.
I hit this assertion by posting a random 150k file with ascii letters and numbers: random150k.txt
Full reproduction here: AndrejsK/ureq3-panic-repro
Reproducible with 3.0.0-rc2 on Linux with only default features on debug build:
Backtrace: