-
Notifications
You must be signed in to change notification settings - Fork 120
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
Unable to send request with body larger than 64Kb #265
Comments
Oh man, I was able to reproduce it in Mint. I don't understand why it works through Finch Mix.install([
{:mint, github: "elixir-mint/mint"},
:castore
])
url = URI.new!("https://nghttp2.org/httpbin/post")
scheme = String.to_existing_atom(url.scheme)
options = [protocols: [:http2]]
{:ok, conn} = Mint.HTTP.connect(scheme, url.host, url.port, options)
{:error, _conn, error} =
Mint.HTTP.request(conn, "POST", url.path, [], :crypto.strong_rand_bytes(65538))
IO.inspect(error) %Mint.HTTPError{
reason: {:exceeds_window_size, :request, 65535},
module: Mint.HTTP2
} |
Briefly looking at Finch.HTTP2.Pool, it implements flow control as described in https://hexdocs.pm/mint/Mint.HTTP2.html#get_window_size/2. The We might have to port HTTP/2 flow control in HTTP/1 connections or give up on the http1/http2 alpn feature. I can look into this. |
You can check if it's a HTTP/2 connection after ALPN upgrade is done and call the |
So ok let me back up a sec to understand this better. Mint itself is behaving correctly it seems, as it's yelling when Finch, instead, is behaving incorrectly because the issue only shows up with What's happening with Sorry for backtracking here a bit, but I don't have that much time to dig into Finch's codebase right now and I’m trying to help out with this as best as I can 😄 |
No worries Andrea, I appreciate your attention here. My understanding is that this issue pops up when we end up using Finch's HTTP1 pool but the connections in that pool are using HTTP2 due to ALPN |
Aaah okay, I see. One thing I still don't understand: we use Okay, but why does the Finch HTTP/2 pool handle large req payloads correctly? If the Finch HTTP/2 pool uses HTTP/2 conns, does it do anything to payloads to prevent this error? |
That's because our H2 pool implements flow control as Wojtek pointed out above |
So to be more specific it's perhaps because H2 always seems to set request body to |
Hi,
I am not totally sure if this is a bug but I found a stranged behaviour in Req when I'm sending a body larger than 64Kb and it seems to be related to Finch
protocols
option.It seems a change in the
protocols
provides different behaviours:With
protocols: [:http1]
:With
protocols: [:http2]
:With
protocols: [:http1, :http2]
:Is it related to the lack of multiplexing when
:http1
is provided?Regards,
The text was updated successfully, but these errors were encountered: