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

akka http client Half-Closes connections, which isn't fully supported by the server #16510

Closed
Joe-Edwards opened this issue Dec 10, 2014 · 9 comments
Assignees
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:http t:io t:stream

Comments

@Joe-Edwards
Copy link

My akka http client looks like:

  override def sendRequest(request: HttpRequest): Future[HttpResponse] = {
    val connection = http.outgoingConnection(request.uri.authority.host.address(), request.uri.effectivePort)

    Source.singleton(request) via connection.flow runWith Sink.head
  }

The TCP layer is doing a half-close (sending a [FIN, ACK]) once the request is sent, and before the response arrives. This isn't forbidden by HTTP, but some servers including the akka http server appear to interpret this as an error and drop the connection, this means the response is never sent.

There is an interesting discussion of the concept at http://lists.w3.org/Archives/Public/ietf-http-wg-old/2001JanApr/0037.html and a related thread https://groups.google.com/forum/#!topic/akka-user/KrNFinhHN6o

I suggest a config option to disable this half-close behaviour, or just eliminate it entirely. At the very least I would expect the server-side code to handle it!

@bantonsson bantonsson added 1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:http t:io t:stream labels Dec 10, 2014
@bantonsson bantonsson added this to the streams-1.0 milestone Dec 10, 2014
@bantonsson
Copy link
Contributor

Thanks a lot @Joe-Edwards for reporting.

@RichardBradley
Copy link
Contributor

I suggest a config option to disable this half-close behaviour, or just eliminate it entirely.

I think we have to eliminate it, or at least make it off-by-default.

This behaviour, while it is apparently valid and seems to make sense, is not supported by most web servers. If Tomcat and other popular servers are "type B" (as per the above link), then Akka can't be a "type 1" client by default.

@drewhk
Copy link
Contributor

drewhk commented Dec 10, 2014

Http client should not use the half-close feature, but Akka TCP must. So I guess it should be a programmatic setting for Akka TCP that HTTP just always sets to "no please" internally.

@RichardBradley
Copy link
Contributor

Good point. This may even need to be handled at the HTTP layer, rather than being a TCP setting. The "type 2" client is defined in terms of the HTTP responses, not in terms of the receive TCP stream.

@jrudolph
Copy link
Contributor

/cc @sirthias

@jrudolph
Copy link
Contributor

Agreed, HTTP doesn't support half-closed connection (which SSL does neither) and we should fix this in the http-core layer.

@jrudolph
Copy link
Contributor

And btw: bonus points for you, @Joe-Edwards, for adding credence to this ticket by referring to a W3C ML post by @milessabin from 2001. 👏

@milessabin
Copy link

And now I feel very old ... :-(

@sirthias sirthias self-assigned this Dec 16, 2014
@sirthias sirthias added the 3 - in progress Someone is working on this ticket label Dec 16, 2014
sirthias added a commit to spray/akka that referenced this issue Dec 17, 2014
sirthias added a commit to spray/akka that referenced this issue Dec 17, 2014
sirthias added a commit to spray/akka that referenced this issue Dec 18, 2014
sirthias added a commit to spray/akka that referenced this issue Dec 18, 2014
sirthias added a commit to spray/akka that referenced this issue Dec 19, 2014
sirthias added a commit to spray/akka that referenced this issue Dec 19, 2014
@rkuhn rkuhn closed this as completed Dec 20, 2014
@rkuhn rkuhn modified the milestones: streams-1.0-M2, streams-1.0 Dec 20, 2014
@rkuhn rkuhn removed the 3 - in progress Someone is working on this ticket label Dec 20, 2014
@RichardBradley
Copy link
Contributor

ktoso pushed a commit to ktoso/akka that referenced this issue Jan 11, 2016
ktoso pushed a commit to ktoso/akka that referenced this issue Jan 11, 2016
ktoso pushed a commit to ktoso/akka that referenced this issue Jan 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - triaged Tickets that are safe to pick up for contributing in terms of likeliness of being accepted t:http t:io t:stream
Projects
None yet
Development

No branches or pull requests

8 participants