Unix.EOPNOTSUPP when trying `dune build --watch` on windows using WSL2
Expected Behavior
Expected that no error happened.
Actual Behavior
Internal error: Uncaught exception.
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.EOPNOTSUPP, "bind", "")
| Raised by primitive operation at Csexp_rpc.Socket.U.bind in file "src/csexp_rpc/csexp_rpc.ml", line 30, characters 23-40
| Called from Csexp_rpc.Socket.bind in file "src/csexp_rpc/csexp_rpc.ml" (inlined), line 83, characters 13-51
| Called from Csexp_rpc.Server.Transport.create in file "src/csexp_rpc/csexp_rpc.ml", line 237, characters 6-29
| Called from Stdune__exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| Re-raised at Stdune__exn.raise_with_backtrace in file "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56
| Called from Stdune__exn_with_backtrace.reraise in file "otherlibs/stdune/exn_with_backtrace.ml", line 18, characters 33-71
| Called from Fiber__core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-11
\-----------------------------------------------------------------------
- Run
wsl. - Open any ocaml project.
dune build --watch.
Specifications
- Version of
dune(output ofdune --version): 3.1.1 - Version of
ocaml(output ofocamlc --version): 4.14.0 - Operating system (distribution and version): Windows 19043.1645 with wsl kernel 5.10.102.1-microsoft-standard-WSL2 with Ubuntu 20.04 LTS
Additional information
- Link to gist with verbose output (run
dunewith the--verboseflag):
Shared cache: disabled
Workspace root: <hidden>
Auto-detected concurrency: 16
Done: 0% (0/0, 0 left) (jobs: 0)/-----------------------------------------------------------------------
| Internal error: Uncaught exception.
| Unix.Unix_error(Unix.EOPNOTSUPP, "bind", "")
| Raised by primitive operation at Csexp_rpc.Socket.U.bind in file "src/csexp_rpc/csexp_rpc.ml", line 30, characters 23-40
| Called from Csexp_rpc.Socket.bind in file "src/csexp_rpc/csexp_rpc.ml" (inlined), line 83, characters 13-51
| Called from Csexp_rpc.Server.Transport.create in file "src/csexp_rpc/csexp_rpc.ml", line 237, characters 6-29
| Called from Stdune__exn_with_backtrace.try_with in file "otherlibs/stdune/exn_with_backtrace.ml", line 9, characters 8-12
| Re-raised at Stdune__exn.raise_with_backtrace in file "otherlibs/stdune/exn.ml" (inlined), line 36, characters 27-56
| Called from Stdune__exn_with_backtrace.reraise in file "otherlibs/stdune/exn_with_backtrace.ml", line 18, characters 33-71
| Called from Fiber__core.O.(>>|).(fun) in file "src/fiber/core.ml", line 250, characters 36-41
| Called from Fiber__scheduler.exec in file "src/fiber/scheduler.ml", line 69, characters 8-11
\-----------------------------------------------------------------------
@nojb any idea what could wrong on WSL?
@p0lunin do you have any network access in WSL? For example does ping 8.8.8.8 or ping google.fr work?
@emillon
root@comp:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=24.4 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=24.3 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=27.5 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=119 time=45.0 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=119 time=24.4 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=119 time=24.4 ms
64 bytes from 8.8.8.8: icmp_seq=7 ttl=119 time=24.3 ms
64 bytes from 8.8.8.8: icmp_seq=8 ttl=119 time=24.4 ms
^C
--- 8.8.8.8 ping statistics ---
8 packets transmitted, 8 received, 0% packet loss, time 7011ms
rtt min/avg/max/mdev = 24.300/27.329/44.987/6.750 ms
hi. Is this still an issue? I suspect that it's due to the fairly old version of the wsl kernel involved. I had a quick look at the kernel sources if WSL adds something particular in bind, but doesn't seem so. I would recommend using a more recent ubuntu version if that's an option.
i have same problem in my macos (big sur) and linux (nixos)
ocaml version: version 5.1.1
dune version: 3.13.0
error when run dune b -w
Uncaught RPC Error
Unix.Unix_error(Unix.EINVAL, "bind", "")
backtrace:
Raised by primitive operation at Csexp_rpc.Socket.U.bind in file
"src/csexp_rpc/csexp_rpc.ml", line 17, characters 23-40
Called from Csexp_rpc.Socket.bind in file "src/csexp_rpc/csexp_rpc.ml"
(inlined), line 74, characters 13-51
Called from Csexp_rpc.Server.create.(fun) in file
"src/csexp_rpc/csexp_rpc.ml", line 400, characters 10-33
Called from Stdlib__List.rev_map.rmap_f in file "list.ml", line 105,
characters 22-25
Called from Stdune__List.map in file "otherlibs/stdune/src/list.ml"
(inlined), line 5, characters 19-33
Called from Csexp_rpc.Server.create in file "src/csexp_rpc/csexp_rpc.ml",
line 390, characters 8-360
Called from Dune_rpc_impl__Server.create in file
"src/dune_rpc_impl/server.ml", line 434, characters 13-74
Called from CamlinternalLazy.do_force_block in file "camlinternalLazy.ml",
line 49, characters 17-27
Re-raised at CamlinternalLazy.do_force_block in file "camlinternalLazy.ml",
line 56, characters 4-11
Called from CamlinternalLazy.force_lazy_block in file "camlinternalLazy.ml"
(inlined), line 78, characters 27-67
Called from Dune_rpc_impl__Server.Run.run.run in file
"src/dune_rpc_impl/server.ml", line 72, characters 19-38
Called from Fiber__Scheduler.exec in file "vendor/fiber/src/scheduler.ml",
line 76, characters 8-11
Error: bind(): Invalid argument
That's super useful, thanks.
Can you install strace (or run under nix-shell -p strace I guess?) and run the following command:
$ strace -e bind dune build -w
and interrupt the process with Ctrl-C
There should be a line like:
bind(10, {sa_family=AF_UNIX, sun_path="_build/.rpc/dune"}, 18) = 0
What does it display?
(alternatively, strace -e bind -o bind.strace dune build -w, interrupt and post the contents of bind.strace)