Skip to content

On Windows, fix stdin broken-pipe and blocking domain. Issues #793 and #792. #795

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

Merged

Conversation

bdodrem
Copy link
Contributor

@bdodrem bdodrem commented Jan 25, 2025

Hi,

The purpose of this pull request is to

@talex5 talex5 force-pushed the windows_read-stdin__issue_793_and_792 branch from bf3c248 to 69098d1 Compare January 27, 2025 11:43
Copy link
Collaborator

@talex5 talex5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me - thanks!

/cc @patricoferris, who added the cstruct stubs file

* fix blocking issue on Windows : issue ocaml-multicore#793.
      Adding await_readable before reading fd

* fix broken pipe exception : issue ocaml-multicore#792.
      Use Unix.read_bigarray instead of Unix_cstruct.read

* replace eio_windows_cstruct_stubs.c by Unix functions.
     Since OCaml 5.2, Unix.read_bigarray and Unix.write_bigarray can be used.
@talex5 talex5 force-pushed the windows_read-stdin__issue_793_and_792 branch from 69098d1 to d3cb04a Compare January 27, 2025 12:04
@talex5
Copy link
Collaborator

talex5 commented Jan 27, 2025

I also bumped the minimum OCaml version to 5.2, since this PR needs it.

@talex5 talex5 merged commit 8f7f82d into ocaml-multicore:main Jan 27, 2025
4 of 5 checks passed
@bdodrem bdodrem deleted the windows_read-stdin__issue_793_and_792 branch February 4, 2025 07:12
talex5 added a commit to talex5/opam-repository that referenced this pull request Jul 20, 2025
CHANGES:

Bug fixes:

- posix: ensure `spawn_unix` wraps errors when calling `openat` (@dijkstracula ocaml-multicore/eio#809).

- Use `O_RESOLVE_BENEATH` on FreeBSD (@talex5 ocaml-multicore/eio#810, reported by @dijkstracula).
  FreeBSD needs `-D__BSD_VISIBLE` to be able to see this.
  Fixed the CI bug this revealed, which had started also affecting macos.

- Ignore `ECONNRESET` on close (@talex5 ocaml-multicore/eio#787).
  FreeBSD returns `ECONNRESET` in certain (unclear) circumstances, but it does still close the FD successfully.
  If you care about this case, you should probably use `shutdown` instead and check for it there.
  Python and Ruby at least both explicitly check for and ignore this error too.

- On Windows, fix stdin broken-pipe and blocked domains (@bdodrem @talex5 ocaml-multicore/eio#795).
  - Ensure blocking FDs are ready before trying to use them.
  - Replace `eio_windows_cstruct_stubs.c` by Unix functions added in OCaml 5.2,
    which correctly handle Window's strange use of `EPIPE`.

Documentation:

- Documentation fixes (@jonludlam ocaml-multicore/eio#813).

- Minor documentation improvements (@talex5 ocaml-multicore/eio#794).

Build fixes:

- Disable `dune subst` (@talex5 ocaml-multicore/eio#789).
talex5 added a commit to talex5/opam-repository that referenced this pull request Jul 20, 2025
CHANGES:

Bug fixes:

- posix: ensure `spawn_unix` wraps errors when calling `openat` (@dijkstracula ocaml-multicore/eio#809).

- Use `O_RESOLVE_BENEATH` on FreeBSD (@talex5 ocaml-multicore/eio#810, reported by @dijkstracula).
  FreeBSD needs `-D__BSD_VISIBLE` to be able to see this.
  Fixed the CI bug this revealed, which had started also affecting macos.

- Ignore `ECONNRESET` on close (@talex5 ocaml-multicore/eio#787).
  FreeBSD returns `ECONNRESET` in certain (unclear) circumstances, but it does still close the FD successfully.
  If you care about this case, you should probably use `shutdown` instead and check for it there.
  Python and Ruby at least both explicitly check for and ignore this error too.

- On Windows, fix stdin broken-pipe and blocked domains (@bdodrem @talex5 ocaml-multicore/eio#795).
  - Ensure blocking FDs are ready before trying to use them.
  - Replace `eio_windows_cstruct_stubs.c` by Unix functions added in OCaml 5.2,
    which correctly handle Window's strange use of `EPIPE`.

Documentation:

- Documentation fixes (@jonludlam ocaml-multicore/eio#813).

- Minor documentation improvements (@talex5 ocaml-multicore/eio#794).

Build fixes:

- Disable `dune subst` (@talex5 ocaml-multicore/eio#789).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants