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

Mill stuck when used on WSL 2 #2120

Closed
Iltotore opened this issue Nov 11, 2022 · 7 comments
Closed

Mill stuck when used on WSL 2 #2120

Iltotore opened this issue Nov 11, 2022 · 7 comments
Labels
feedback wanted Additional feedback or testing is apreciated
Milestone

Comments

@Iltotore
Copy link
Contributor

Iltotore commented Nov 11, 2022

Mill version: 0.10.9 (also tested in 0.10.4+)
OS: WSL Debian GNU/Linux 11 (bullseye) on Windows 10 x86_64
Java: openjdk version "17.0.4" 2022-07-19

Using Mill on WSL results in this error:

Exception in thread "main" org.newsclub.net.unix.InvalidArgumentSocketException: Invalid argument
        at org.newsclub.net.unix.NativeUnixSocket.bind(Native Method)
        at org.newsclub.net.unix.AFSocketImpl.bind(AFSocketImpl.java:335)
        at org.newsclub.net.unix.AFServerSocket.bind(AFServerSocket.java:257)
        at java.base/java.net.ServerSocket.bind(ServerSocket.java:342)
        at org.newsclub.net.unix.AFServerSocket.bindOn(AFServerSocket.java:176)
        at org.newsclub.net.unix.AFUNIXServerSocket.bindOn(AFUNIXServerSocket.java:87)
        at mill.main.Server.$anonfun$run$2(MillServerMain.scala:103)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at mill.main.Server$.lockBlock(MillServerMain.scala:227)
        at mill.main.Server.$anonfun$run$1(MillServerMain.scala:98)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at mill.main.Server$.tryLockBlock(MillServerMain.scala:235)
        at mill.main.Server.run(MillServerMain.scala:95)
        at mill.main.MillServerMain$.main(MillServerMain.scala:53)
        at mill.main.MillServerMain.main(MillServerMain.scala)

followed by a hanging. Relaunching Mill hangs without the above error but it prints again if I delete the out/mill directory.

It doesn't seem to be related to #874

@sake92
Copy link
Contributor

sake92 commented Nov 14, 2022

Seems like WSL 2 doesn't support Unix sockets.
https://stackoverflow.com/a/73067921/4496364

You'll have to use no-server mode mill -i, or try native Windows.

@lefou
Copy link
Member

lefou commented Nov 14, 2022

Please note that I just discovered that the bundled mill script of 0.10.9 release has some issues with -i or --no-server mode. See #2123 (comment).

Let's see if we can detect a running WSL 2 from a running Mill process, so that we can always fall back to --no-server mode.

@Iltotore
Copy link
Contributor Author

I tested with both wrapper and "normal" Mill command. Still no success. I tested with annd without -i. I don't know if --no-server would change anything but I will test it once I get to home.

@sake92
Copy link
Contributor

sake92 commented Jan 30, 2023

I tested it on my Windows 11:

sake@DESKTOP-ILD4SJJ:/mnt/c/projects/stuff/millll/jah4$ ./mill-0.10.11-assembly.bat -i jah4.run
Compiling /mnt/c/projects/stuff/millll/jah4/build.sc
[13/46] jah4.unmanagedClasspath
[33/46] jah4.compile
Compiling compiler interface...
[info] compiling 1 Scala source to /mnt/c/projects/stuff/millll/jah4/out/jah4/compile.dest/classes ...
[info] done compiling
[46/46] jah4.run
Hello world!


sake@DESKTOP-ILD4SJJ:/mnt/c/projects/stuff/millll/jah4$ ./mill-0.10.11-assembly.bat  jah4.run
Exception in thread "main"
org.newsclub.net.unix.AddressUnavailableSocketException: Operation not supported
        at org.newsclub.net.unix.NativeUnixSocket.bind(Native Method)
        at org.newsclub.net.unix.AFSocketImpl.bind(AFSocketImpl.java:335)
        at org.newsclub.net.unix.AFServerSocket.bind(AFServerSocket.java:257)
        at java.net.ServerSocket.bind(ServerSocket.java:344)
        at org.newsclub.net.unix.AFServerSocket.bindOn(AFServerSocket.java:176)
        at org.newsclub.net.unix.AFUNIXServerSocket.bindOn(AFUNIXServerSocket.java:87)
        at mill.main.Server.$anonfun$run$2(MillServerMain.scala:103)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at mill.main.Server$.lockBlock(MillServerMain.scala:227)
        at mill.main.Server.$anonfun$run$1(MillServerMain.scala:98)
        at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
        at mill.main.Server$.tryLockBlock(MillServerMain.scala:235)
        at mill.main.Server.run(MillServerMain.scala:95)
        at mill.main.MillServerMain$.main(MillServerMain.scala:53)
        at mill.main.MillServerMain.main(MillServerMain.scala)
Exception in thread "main" java.lang.Exception: Failed to connect to server
        at mill.main.client.MillClientMain.run(MillClientMain.java:195)
        at mill.main.client.MillClientMain.main0(MillClientMain.java:121)
        at mill.main.client.MillClientMain.main(MillClientMain.java:71)
Caused by: java.net.SocketException: No such file or directory
        at org.newsclub.net.unix.NativeUnixSocket.connect(Native Method)
        at org.newsclub.net.unix.AFSocketImpl.connect0(AFSocketImpl.java:392)
        at org.newsclub.net.unix.AFSocket.connect0(AFSocket.java:267)
        at org.newsclub.net.unix.AFSocket.connect(AFSocket.java:236)
        at org.newsclub.net.unix.AFSocket.connect(AFSocket.java:231)
        at org.newsclub.net.unix.AFSocket.connectTo(AFSocket.java:179)
        at org.newsclub.net.unix.AFUNIXSocket.connectTo(AFUNIXSocket.java:109)
        at mill.main.client.MillClientMain.run(MillClientMain.java:187)
        ... 2 more

Works as expected. In the -i mode does what it's told.
Client-server doesn't work since WSL doesn't support unix sockets yet.

@lefou
Copy link
Member

lefou commented Jan 30, 2023

If you can tell me, how I can safely detect a WSL 2 environment, then we can safeguard to always use the non-server mode on WSL 2.

@lefou lefou added the feedback wanted Additional feedback or testing is apreciated label Mar 4, 2023
@andrelfpinto
Copy link
Contributor

scala> System.getProperty("os.version")
val res2: String = 5.15.90.1-microsoft-standard-WSL2

works if it is not a custom kernel.

I guess this option is not that usual. In this case, one can always run it with --no-server.

@lefou
Copy link
Member

lefou commented Dec 1, 2023

I just merged #2901 to always run in no-server mode on WSL.

@lefou lefou closed this as completed Dec 1, 2023
@lefou lefou added this to the 0.11.7 milestone Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback wanted Additional feedback or testing is apreciated
Projects
None yet
Development

No branches or pull requests

4 participants