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

Resource temporarily unavailable (EAGAIN) on recv #23

Open
rizo opened this issue Aug 22, 2017 · 0 comments
Open

Resource temporarily unavailable (EAGAIN) on recv #23

rizo opened this issue Aug 22, 2017 · 0 comments

Comments

@rizo
Copy link
Contributor

rizo commented Aug 22, 2017

Running a simple Lwt-based example that uses Nanomsg_lwt.recv_string fails with the following error:

Fatal error: exception Nanomsg_lwt.Error("", "Resource temporarily unavailable")
Raised at file "src/core/lwt.ml", line 2719, characters 24-25
Called from file "src/unix/lwt_main.ml", line 33, characters 8-18

Here is the minimum program that can be used to reproduce the issue:

(* ocamlbuild -pkg lwt -pkg nanomsg.lwt tmp/nn_recv_lwt.native *)

let bind_pull addr =
  let addr = Nanomsg.Addr.bind_of_string addr in
  let socket = Nanomsg.socket_exn Nanomsg.Pull in
  let _eid = Nanomsg.bind_exn socket addr in
  socket

open Lwt.Infix

let () =
  let socket = bind_pull "tcp://127.0.0.1:9090" in
  Lwt_main.run begin
    Nanomsg_lwt.recv_string socket >>= fun str ->
    Lwt_io.printl str
  end

The equivalent blocking call to recv does work:

let () =
  let socket = bind_pull "tcp://127.0.0.1:9090" in
  Lwt_main.run begin
    match Nanomsg.recv_string socket with
    | Ok str -> Lwt_io.printl str
    | Error e -> Lwt_io.printl "err"
  end

I suspect it is related to the fact that the calls to bind and connect are natively asynchronous (related issue in nanomsg).

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

No branches or pull requests

1 participant