--spawn_strategy=remote doesn't seem to be recognized
Hi, I attempted to follow the readme here to set up Hazelcast: https://github.com/bazelbuild/bazel/tree/master/src/main/java/com/google/devtools/build/lib/remote
I was able to get the Hazelcast server up and then I attempted to connect to it with a version of bazel built from HEAD:
ubuntu@ip-10-1-0-54:~/bazel$ bazel help
[bazel release head (@c5a5d90)]
Usage: bazel
This was built with ./compile.sh
I followed the README and attempted to connect:
ubuntu@ip-10-1-0-54:~/bazel$ sudo /home/ubuntu/bazel/output/bazel build --hazelcast_node=localhost:5701 --spawn_strategy=remote src/tools/generate_workspace:all
INFO: Waiting for response from Bazel server (pid 94173)... ERROR: 'remote' is an invalid value for spawn strategy. Valid values are: local, sandboxed, standalone, worker.
For some reason it says that the "remote" strategy is invalid. Is there a step I am missing here?
@philwo, @hhclam - Can you take a look?
@xynny I wonder if there's a little bug in the code that only activates the remote strategy when its configuration (--hazelcast_node) has been provided.
Could you please try to do a normal build like this first (no --spawn_strategy and no target on the command-line, just like this): bazel build --hazelcast_node=localhost:5701
And then run your full command-line again: bazel build --hazelcast_node=localhost:5701 --spawn_strategy=remote src/tools/generate_workspace:all
Does it work then? If yes, I know where the bug is and can send a fix tomorrow or on Friday. If not, I'll have to check this out in detail when I'm back in the office next week. :)
no this still doesn't work:
jenkins@ip-10-1-0-32:~/workspace/BazelUnitTests$ bazel build --hazelcast_node=localhost:5701 ...... INFO: Waiting for response from Bazel server (pid 41613)... INFO: Found 0 targets... INFO: Elapsed time: 8.935s, Critical Path: 0.00s jenkins@ip-10-1-0-32:~/workspace/BazelUnitTests$ bazel build --hazelcast_node=localhost:5701 --spawn_strategy=remote src/tools/generate_workspace:all INFO: Waiting for response from Bazel server (pid 41613)... ERROR: 'remote' is an invalid value for spawn strategy. Valid values are: local, sandboxed, standalone, worker. INFO: Elapsed time: 6.077s
oh okay I rebuilt bazel master and then did the two steps and it no longer throws the 'remote' is an invalid value for spawn strategy error. The previous comment was using the 0.2.0 release. This is what happened with master: ubuntu@ip-10-1-0-176:~/bazel$ sudo /home/ubuntu/bazel/output/bazel build --hazelcast_node=localhost:5701 Extracting Bazel installation... Sending SIGTERM to previous Bazel server (pid=28471)... done. ....... INFO: Found 0 targets... INFO: Elapsed time: 4.620s, Critical Path: 0.01s ubuntu@ip-10-1-0-176:~/bazel$ sudo /home/ubuntu/bazel/output/bazel build --hazelcast_node=localhost:5701 --spawn_strategy=remote src/tools/generate_workspace:all INFO: Found 2 targets... ERROR: /home/ubuntu/bazel/src/main/native/BUILD:13:1: Executing genrule //src/main/native:copy_link_jni_header failed: namespace-sandbox failed: error executing command /home/ubuntu/.cache/bazel/_bazel_root/ffdf15b7269c0b208fa140f8b561f825/bazel/_bin/namespace-sandbox ... (remaining 5 argument(s) skipped). src/main/tools/namespace-sandbox.c:507: mount(opt->sandbox_root, opt->sandbox_root, NULL, MS_BIND | MS_NOSUID, NULL): Permission denied INFO: Elapsed time: 3.360s, Critical Path: 3.16s
Please feel free to assign this to me. Philipp is right that if hazelcast_node is not specified then remote spawn strategy is not provided.
another datapoint. I got this to work on a mac by just following the readme, but on my ubuntu machines the behavior is broken as described above. It is probably because sandboxing is on by default on the linux machine.
xynny: I think the reason that it complains about namespace-sandbox has nothing to do with remote spawn strategy. For a non-remotable task it just uses other spawn strategies such as linux sandbox or local. The issue seems to be that namespace sandbox doesn't work on your linux box.
There's an actual bug that 'remote' spawn strategy is not available if --hazelcast_node is not specified. We're working on a fix for the latter issue.
Ping on this issue -- any workaround we can apply in the source in the meantime?
glinscott: what's the issue you are referring to? "remote" strategy is invalid or the sandbox complaining?
I'm able to reproduce this on bazel 0.2.1 on Linux.
The proposed workaround (bazel build --hazelcast_node=remote_host:5701 and then bazel build --hazelcast_node=remote_host:5701 --spawn_strategy=remote ...) does not work either.
@trainman419: what's the error message?
@hhclam:
This is the error message:
$ bazel build --spawn_strategy=remote --hazelcast_node=170.0.0.1:5701 ...
INFO: Waiting for response from Bazel server (pid 23277)...
ERROR: 'remote' is an invalid value for spawn strategy. Valid values are: local, sandboxed, standalone, worker.
INFO: Elapsed time: 10.258s
Same error message as above:
INFO: Waiting for response from Bazel server (pid 9797)...
ERROR: 'remote' is an invalid value for spawn strategy. Valid values are: local, sandboxed, standalone, worker.
INFO: Elapsed time: 10.119s
Of particular note, the hazelcast node is running on a machine that doesn't appear to be reachable from my computer. (but bazel doesn't report that as the error)
I've confirmed that this was a network issue; once I resolved my network connectivity issue I was able to use bazel build --hazelcast_node=remote_host:5701 --spawn_strategy=remote ...
Please provide an error message when the remote hazelcast node is unreachable.
When I try the above, I get INFO: Waiting for response from Bazel server (pid 16771)... which hangs forever, or at least a few minutes before I Ctrl-C out of it.
bazel build --hazelcast_node=127.0.0.1:5701 src/tools/generate_workspace:all
Extracting Bazel installation...
Sending SIGTERM to previous Bazel server (pid=11899)... done.
.
INFO: Waiting for response from Bazel server (pid 16771)...
Meanwhile, the hazelcast server running locally does indeed acknowledge the socket connection:
May 04, 2016 2:37:27 PM com.hazelcast.nio.tcp.SocketAcceptorThread
INFO: [192.168.99.1]:5701 [dev] [3.6.2] Accepting socket connection from /127.0.0.1:60108
May 04, 2016 2:37:27 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [192.168.99.1]:5701 [dev] [3.6.2] Established socket connection between /127.0.0.1:5701 and /127.0.0.1:60108
Update: After Ctrl-C'ing twice on Bazel ( it apparently takes three Ctrl-C's to actually kill the process 😄 ), Bazel starts building again, and Hazelcast spits out the following:
May 04, 2016 2:47:27 PM com.hazelcast.nio.tcp.SocketAcceptorThread
INFO: [192.168.99.1]:5701 [dev] [3.6.2] Accepting socket connection from /127.0.0.1:60339
May 04, 2016 2:47:27 PM com.hazelcast.nio.tcp.nonblocking.NonBlockingSocketWriter
WARNING: [192.168.99.1]:5701 [dev] [3.6.2] hz._hzInstance_1_dev.IO.thread-out-0 Closing socket to endpoint null, Cause:java.nio.channels.ClosedChannelException
May 04, 2016 2:47:27 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [192.168.99.1]:5701 [dev] [3.6.2] Connection [/127.0.0.1:60108] lost. Reason: java.io.EOFException[Remote socket closed!]
May 04, 2016 2:47:27 PM com.hazelcast.nio.tcp.TcpIpConnectionManager
INFO: [192.168.99.1]:5701 [dev] [3.6.2] Established socket connection between /127.0.0.1:5701 and /127.0.0.1:60339
May 04, 2016 2:47:27 PM com.hazelcast.nio.tcp.nonblocking.NonBlockingSocketReader
WARNING: [192.168.99.1]:5701 [dev] [3.6.2] hz._hzInstance_1_dev.IO.thread-in-0 Closing socket to endpoint null, Cause:java.io.EOFException: Remote socket closed!
May 04, 2016 2:47:29 PM com.hazelcast.nio.tcp.nonblocking.NonBlockingSocketWriter
WARNING: [192.168.99.1]:5701 [dev] [3.6.2] hz._hzInstance_1_dev.IO.thread-out-1 Closing socket to endpoint null, Cause:java.nio.channels.ClosedChannelException
May 04, 2016 2:47:29 PM com.hazelcast.nio.tcp.TcpIpConnection
INFO: [192.168.99.1]:5701 [dev] [3.6.2] Connection [/127.0.0.1:60339] lost. Reason: java.io.EOFException[Remote socket closed!]
May 04, 2016 2:47:29 PM com.hazelcast.nio.tcp.nonblocking.NonBlockingSocketReader
WARNING: [192.168.99.1]:5701 [dev] [3.6.2] hz._hzInstance_1_dev.IO.thread-in-1 Closing socket to endpoint null, Cause:java.io.EOFException: Remote socket closed!
@adamhowardprice: if you don't have --spawn_strategy=remote and just having --hazelcast_node has no added value. You can do a bazel shutdown to tell bazel to shutdown, so you don't need to rely on ctr-c. I think the problem is there's some issues connecting to the hazelcast server that caused an unchecked exception and bazel dies. I noticed you're using hazelcast server 3.6.2, have you tried the version that comes with bazel source tree, this maybe a backward compability issue with hazelcast. I'll update both the hazelcast soon.
@trainman419: you're right that it doesn't warn against an invalid hazelcast host. something should be fixed.
@glinscott: have you checked if it is a connectivity issue? @trainman419 is right: if there's a connectivity issue then "remote" strategy is not available.
@hhclam - it was the same issue, thanks!
@hhclam The version of hazelcast that Bazel uses worked for me. Thanks!
Just to summarize what's left to be done here: From reading the history of this bug, I think the remaining work is to improve error messages on connectivity failures, so that Bazel doesn't just print "'remote' is an unknown strategy" (or something like that).
I'm going to close this bug - I know that we still need to improve our error handling, but I always do a double-take when I see this issue.