-
Notifications
You must be signed in to change notification settings - Fork 6
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
Jetty client sometimes uses chunked transfer encoding for GET requests #16
Comments
I was looking at this and noticed a few things:
For context we ran into this issue when talking to an akka-http server that gives an annoying "Sending an 2xx early" warning for any GET request with |
We have seen some errors in production with the 0 These are very infrequent in percentage terms, but they do occur.
|
do you use request bodies on those GET requests? |
@hamnis No, it's just a simple |
When sending a
GET
request (no body) using the Jetty client sometimes it sends multiple network-level requests and usesTransfer-Encoding: chunked
. From local testing manually settingcontent-length
to0
means this issue does not occur.I've tried to produce a test with
TestContext
fromcats-effect
but trying to use the Jetty client leads to a deadlock (I can create it and tear it down with no issues).If I had to guess I would say this is due to a race between the Jetty request being sent and the content for that request being populated, the lines are here:
https://github.com/http4s/http4s/blob/30798ab62e4d4739249692e7e80a8831654aa28a/jetty-client/src/main/scala/org/http4s/client/jetty/JettyClient.scala#L28
If the request sends (
jReq.send(rl)
) before the delayed content has written (dcp.write(req)
,dcp
is aStreamRequestContentProvider
) the request will be chunked.Possibly just inverting these lines might mean the race is less likely? Unless are that way around for a reason (send before write).
http4s version:
0.21.0-M5
. Sorry, only just realised this isn't the latest but I think there have been no changes between versions.The text was updated successfully, but these errors were encountered: