Open wangyoucao577 opened 1 year ago
The server itself does not hang when a client close the connection abruptly, but there isn't a good way to see the error in hyper 0.14. In hyper v1.0.1, it will be propagated to the caller as UnexpectedEof
The error propagation stops here: https://github.com/hyperium/hyper/blob/dedcb674f35eaec765a42b550caabe6f694d86d1/src/server/server.rs#L794, and it's only written to debug-level logs.
Version
v0.14.27
Platform
Linux demo 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Tested on several other linux platforms(ubuntu, debian, etc), same issue occurred.Description
I tried this code: add a
stream
request handler in theecho
example as below.then run it
Open another terminal, and test against the server by
curl
:I expected to see this happen:
Normally logs like below will output by the
echo
server ifcurl
finished correctly(transfer succeed), which is expected.However, if
curl
was interruptted byCTRL + C
, thestream body finished
won't be printed and the session seems hang forever on the server side.