-
Notifications
You must be signed in to change notification settings - Fork 176
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
cohttp-eio: "large" chunked-response → exception Eio.Io Unix_error (Invalid argument, "writev", "") #1005
Comments
Actually with exactly the With this change, we get the behavior above ( diff --git a/vendor/cohttp/cohttp-eio/src/utils.ml b/vendor/cohttp/cohttp-eio/src/utils.ml
index 8478eac4..8d1cee93 100644
--- a/vendor/cohttp/cohttp-eio/src/utils.ml
+++ b/vendor/cohttp/cohttp-eio/src/utils.ml
@@ -45,7 +45,7 @@ let flow_of_reader =
fun read_body_chunk -> Eio.Resource.T (Reader_flow.v read_body_chunk, handler)
let flow_to_writer flow writer write_body =
- let input = Eio.Buf_read.of_flow ~max_size:max_int flow in
+ let input = Eio.Buf_read.of_flow ~initial_size:1024 ~max_size:max_int flow in
let rec loop () =
let () =
let () = Eio.Buf_read.ensure input 1 in |
With They both fail. with They both succeed. |
With: let handler _socket request _body =
let u = Http.Request.resource request |> Uri.of_string in
match Uri.path u with
| "/" ->
(Http.Response.make (), Cohttp_eio.Body.of_string text) (* | "/body" -> *)
| "/body" ->
let size = Uri.get_query_param u "size" |> Option.get |> int_of_string in
(Http.Response.make (), Cohttp_eio.Body.of_string (String.make size 'B'))
| "/flow" ->
let size = Uri.get_query_param u "size" |> Option.get |> int_of_string in
(Http.Response.make (), Eio.Flow.string_source (String.make size 'B')) We can make crash the
|
OK This might be an Eio bug (?). Playing with the initial-buffer-sizes and this: diff --git a/vendor/eio/lib_eio_posix/flow.ml b/vendor/eio/lib_eio_posix/flow.ml
index 2588bf11..3ac9795a 100644
--- a/vendor/eio/lib_eio_posix/flow.ml
+++ b/vendor/eio/lib_eio_posix/flow.ml
@@ -43,6 +43,8 @@ module Impl = struct
try
Low_level.writev t (Array.of_list bufs)
with Unix.Unix_error (code, name, arg) ->
+ traceln "ERROR vendor/eio/lib_eio_posix/flow.ml bufs: %d"
+ (List.length bufs);
raise (Err.wrap code name arg)
let copy t ~src = Eio.Flow.Pi.simple_copy ~single_write t ~src We can see that it fails when the call to posix-writev gets an array of more than 1024 buffers, which is indeed the value of |
This may be related to observations in #1004
Using the
master
branch.I've modifed
cohttp-eio/examples/server1.ml
like this:When we call
/ko
, the server dies with:Here are the corresponding
curl
calls:The text was updated successfully, but these errors were encountered: