ocaml-multicore / eio

Effects-based direct-style IO for multicore OCaml
Other
540 stars 66 forks source link

Keep writes within IOV_MAX #633

Open talex5 opened 10 months ago

talex5 commented 10 months ago

Calling Flow.write with more than IOV_MAX buffers results in EINVAL. This can happen when e.g. using Buf_write to write a lot of data without flushing.

Reported by @Cjen1 (see https://github.com/Cjen1/prototyping-testing/tree/master/eio-pipe).

Implementations of Flow.write with such limits should just truncate the list of buffers. Possibly Buf_write should also know the limit and flush before sending so many (or just use a low enough limit that it work on all platforms).

On Linux, https://github.com/ocaml-multicore/ocaml-uring/pull/76 can be used to get the limit.

smondet commented 10 months ago

I think this is the same issue: https://github.com/mirage/ocaml-cohttp/issues/1005