hypercorn
hypercorn copied to clipboard
hypercorn abruptly closes client connection in the in the middle of test suite execution
I open up a connection to a quart http2 server, and send several http2 requests one after another over the same connection. After servicing about 5 or 6 requets, hypercorn seems to be closing the client connection abruptly. This started happening when I upgraded from 0.13.2 to 0.14.0/0.14.1
I looked at the tcp_server.py in 0.14.1 and it looks like if self.reader.at_eof() is true, the code ultimately calls self.writer.close() which seems to close the socket.
I will do more research and post my findings here.
Upon further research and using wireshark to see traffic flow, hypercorn initiates the TCP close. http2 allows for long lived connections, so the reason for hypercorn closing the client connection is not entirely clear. Can someone comment on why this behavior changed from 1.13.2 to 1.14.0 ?
We also do the following in our http2 server
from hypercorn import Config as HConfig
# Hypercorn default config sets a connection idle timeout to 5 seconds. This
# will cause the connection to the server to occasionally drop when running on
# slower systems. We do not need idle connection timeout for CI - disable it.
#
HConfig.keep_alive_timeout = 50000.0
I am having at minimum a similar problem. Hypercorn is closing connections on certain endpoints, that work in 0.13.2. I haven't had a chance to debug it much, other than to confirm that keep_alive_timeout did not resolve the issue.
If this is still a problem please open a new issue - I'd need a little more information and ideally a minimal reproducible example to fix it though.