Closed dsyer closed 2 years ago
I think this is happening at JVM level. Can you configure Java environment instead of enabling IPV6 in Docker daemon?
I mostly clueless on Docker containers but found following online:
ENV JAVA_OPTS="-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true"
I think you mean JAVA_TOOL_OPTIONS
? Anyway it doesn't work even though you can see it being logged as in use:
$ bazel run samples/wasm/src/main/java/com/google/j2cl/samples/wasm:jsapp_dev_server
INFO: Analyzed target //samples/wasm/src/main/java/com/google/j2cl/samples/wasm:jsapp_dev_server (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //samples/wasm/src/main/java/com/google/j2cl/samples/wasm:jsapp_dev_server up-to-date:
bazel-bin/samples/wasm/src/main/java/com/google/j2cl/samples/wasm/jsapp_dev_server
bazel-bin/samples/wasm/src/main/java/com/google/j2cl/samples/wasm/jsapp_dev_server.ignoreme
INFO: Elapsed time: 0.803s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Build completed successfully, 1 total action
Picked up JAVA_TOOL_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true
Jun 03, 2022 9:25:46 AM io.bazel.rules.closure.webfiles.server.WebfilesServer run
SEVERE: Webfiles server died
java.net.SocketException: Protocol family unavailable
at java.base/java.net.PlainSocketImpl.socketBind(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:436)
at java.base/java.net.ServerSocket.bind(ServerSocket.java:395)
at java.base/java.net.ServerSocket.<init>(ServerSocket.java:257)
at java.base/javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:231)
at io.bazel.rules.closure.webfiles.server.NetworkUtils.createServerSocket(NetworkUtils.java:51)
at io.bazel.rules.closure.webfiles.server.WebfilesServer.runForever(WebfilesServer.java:137)
at io.bazel.rules.closure.webfiles.server.WebfilesServer.run(WebfilesServer.java:125)
at io.bazel.rules.closure.webfiles.server.WebfilesServer.main(WebfilesServer.java:76)
I am guessing this is not fixed with the flag since the default address is still IPV6: https://github.com/bazelbuild/rules_closure/blob/03e1d4111227f88402da409e2b69a4ada5953550/closure/webfiles/web_library.bzl#L131
You may need both to fix this. I will check if I can change the default address.
Out of the box without ipv6 enabled:
It works if you enable ipv6, but that's a huge pain for a lot of users. The Docker daemon does not enable ipv6 by default so if you want to build in a container you can't, without doing some manual configuration. It would be easier if it just worked.