Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket remains ESTABLISHED after keep_alive_timeout #170

Open
jonathanslenders opened this issue Dec 6, 2023 · 0 comments
Open

Socket remains ESTABLISHED after keep_alive_timeout #170

jonathanslenders opened this issue Dec 6, 2023 · 0 comments

Comments

@jonathanslenders
Copy link

The keep_alive_timeout config does cause the TLS stream to be terminated, but it won't close the underlying socket, which remains in the ESTABLISHED state.

This was discovered while troubleshooting an httpx issue. See: encode/httpx#2983

I can see that Hypercorn does call asyncio.StreamWriter.close() after the idle timeout. However, the transport is of type asyncio.sslproto._SSLProtocolTransport, which means there's no guarantee that the actual socket is closed. Looking at netstat, the TCP socket remains ESTABLISHED even after Hypercorn tries to close the writer.

Of course, if the HTTP client responds to the TLS termination by closing the socket from the client's side, it will get closed, but otherwise, the socket will remain open.

Maybe we want to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant