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

Fix TLS socket read stall immediately after handshake #2461

Merged

Conversation

mpilquist
Copy link
Member

I ran in to an issue with http4s ember servers where JRE HttpsURLConnection clients would stall occasionally. The TLS handshake would complete but ember server would timeout while reading the request body, eventually resulting in a 500 response indicating a request timeout.

The issue was caused by unwrapped data remaining in the unwrapBuffer after the handshake completed. As a result, the request to read from the TLS socket would result in an underlying read on the raw socket, but there's no further data available, and hence the read would timeout.

I tried reproducing in a test in fs2-io but due to various timing and buffer sizing sensitivities, I was unsuccessful. I have confirmed a fix using this http4s test though: https://gist.github.com/mpilquist/82726e0f8ff740defca6a235bf3efd41

@mpilquist mpilquist merged commit c76f6b8 into typelevel:main Jul 3, 2021
@mpilquist mpilquist deleted the topic/tls-read-stall-after-handshake branch February 18, 2024 13:34
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

Successfully merging this pull request may close these issues.

1 participant