Description
I have a golang https server to which a rust client sends lot of parallel requests.
After few hundreds of requests, it stops and apparently there is no TCP communication.
The REST API accepts a byte buffer in a body and responds back with its length in a json.
To reproduce, the entire code is at: https://github.com/staticgc/hyper-stuck
It has golang server, Rust Client & Golang Client
The build instructions are very straightforward
The default max number of futures spawned are 400
This apparently is more than the max number of http2 streams at server (which is 250)
If the count is reduced to 200 it works.
Other observations:
- Golang client works with high goroutine count
- Increasing connections in Rust client from 1 to say 3 causes more requests to be processed but again gets stuck
- With 400 futures/requests, when the number of connections = 10 (chosen arbitrarily) it worked ok.
- When HTEST_BUF_SIZE is reduced to say 1KB then even with 1 connection & high future count it works
- If the rust client stops, it does so after predictable number of requests
Number of connections here refers to http2 negotiated connection which hyper (I think) creates only 1 per Client
instance.
So changing HTEST_CONN_COUNT changes the number of Client
instances that are created.
Also to prevent initial flooding at the server, the rust client makes a single http2 request on each Client
instance and then issues the parallel requests.
for i in 0..conn_count {
send_req_https(client_vec[i].clone(), bufsz, url.as_str()).await?;
}
Able to reproduce on: Mac OS & Cent OS Linux
Edit: Apologies for some typos in build instructions in the repo above. I have fixed those. Let me know here if anything remains.