Closed prepor closed 11 months ago
It seems that you found the issue, could you submit a PR?
@diml I'm not sure how to fix it. What we have: at least on macOS Unix sockets don't support SO_ACCEPTCONN option. I can't find any RFC or something which describes this behavior.
I suppose the code could be changed to not call getsockopt/setsockopt with SO_ACCEPTCONN
on OSX.
I've just hit this with an Async-based HTTP server too. Seems that OSX (and possibly BSD generally) doesn't support SO_ACCEPTCONN
from what I've been able to dig up.
For completeness sake, this is the error I am getting the first time something tries to connect to the server:
(((pid 57454) (thread_id 0)) "2018-11-12 01:05:39.723251Z"
"unhandled exception in Async scheduler"
("unhandled exception"
((monitor.ml.Error
(Unix.Unix_error "Protocol not available" getsockopt
"((fd 1) (opt SO_ACCEPTCONN))")
("Raised at file \"src/core_unix.ml\", line 50, characters 4-43"
"Called from file \"src/fd.ml\", line 31, characters 17-57"
"Called from file \"src/fd.ml\", line 54, characters 9-52"
"Called from file \"camlinternalLazy.ml\", line 27, characters 17-27"
"Re-raised at file \"camlinternalLazy.ml\", line 34, characters 4-11"
"Called from file \"src/writer0.ml\", line 1409, characters 24-36"
"Called from file \"src/result.ml\", line 161, characters 9-15"
"Caught by monitor main"))
((pid 57454) (thread_id 0)))))
Hey!
Code to reproduce:
Result:
OS: macOS 10.13.4 Ocaml: 4.05.0
The problem is here https://github.com/janestreet/async_unix/blob/master/src/fd.ml#L31.
It means that we can't infer Unix.Fd from Unix domain sockets. Nodejs, for example, uses Unix domain sockets for stdio with child processes by default (so things like
force Reader.stdin
fails).Code to reproduce with nodejs:
ocaml:
JS: