Skip to content
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

Lwt_io.establish_server_generic doesn't handle ECONNABORTED #829

Closed
reynir opened this issue Dec 17, 2020 · 0 comments · Fixed by #830
Closed

Lwt_io.establish_server_generic doesn't handle ECONNABORTED #829

reynir opened this issue Dec 17, 2020 · 0 comments · Fixed by #830
Milestone

Comments

@reynir
Copy link
Contributor

reynir commented Dec 17, 2020

I have been running an opium server on FreeBSD, and it failed with ECONNABORTED in Lwt_unix.accept. It seems Lwt_io.establish_server_generic doesn't handle this error as well.

lwt/src/unix/lwt_io.ml

Lines 1598 to 1627 in 0985a5b

let rec accept_loop () =
let try_to_accept =
Lwt_unix.accept listening_socket >|= fun x ->
`Accepted x
in
Lwt.pick [try_to_accept; should_stop] >>= function
| `Accepted (client_socket, client_address) ->
begin
try Lwt_unix.set_close_on_exec client_socket
with Invalid_argument _ -> ()
end;
connection_handler_callback client_address client_socket;
accept_loop ()
| `Should_stop ->
Lwt_unix.close listening_socket >>= fun () ->
begin match listening_address with
| Unix.ADDR_UNIX path when path <> "" && path.[0] <> '\x00' ->
Unix.unlink path
| _ ->
()
end [@ocaml.warning "-4"];
Lwt.wakeup_later notify_listening_socket_closed ();
Lwt.return_unit
in

reynir added a commit to reynir/lwt that referenced this issue Dec 17, 2020
Call accept again if ECONNABORTED.
Fixes ocsigen#829
raphael-proust pushed a commit to reynir/lwt that referenced this issue Feb 11, 2021
Call accept again if ECONNABORTED.
Fixes ocsigen#829
raphael-proust pushed a commit that referenced this issue May 27, 2021
Call accept again if ECONNABORTED.
Fixes #829
raphael-proust pushed a commit to reynir/lwt that referenced this issue May 27, 2021
Call accept again if ECONNABORTED.
Fixes ocsigen#829
@raphael-proust raphael-proust added this to the 5.4.1 milestone May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants