Skip to content

Commit

Permalink
Merge pull request #787 from talex5/freebsd-close
Browse files Browse the repository at this point in the history
Ignore ECONNRESET on close
  • Loading branch information
talex5 authored Dec 6, 2024
2 parents f26d70d + 1766568 commit f195295
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib_eio/tests/dscheck/unix.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
type error = ECONNRESET

exception Unix_error of error * string * string

type file_descr = [`Open | `Closed] Atomic.t

let make () = Atomic.make `Open
Expand Down
8 changes: 7 additions & 1 deletion lib_eio/unix/rcfd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ let get t =
None

let close_fd fd =
Eio.Private.Trace.with_span "close" (fun () -> Unix.close fd)
Eio.Private.Trace.with_span "close" (fun () ->
try
Unix.close fd
with Unix.Unix_error (ECONNRESET, _, _) ->
(* For FreeBSD. See https://github.com/ocaml-multicore/eio/issues/786 *)
()
)

(* Note: we could simplify this a bit by incrementing [t.ops], as [remove] does.
However, that makes dscheck too slow. *)
Expand Down

0 comments on commit f195295

Please sign in to comment.