-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
can't use docker spawn strategy on mac #5397
Comments
You are running into issues related to having the host environment (where bazel runs) different to the execution environment (the docker container). |
@nlopezgi : Thanks for the detailed analysis! Is there a bug we need to fix or can we close the issue? |
Thanks Nick!
Is there a way for us to track down the which of the rules we use depend on
existing binaries (for example the jar utility) and are there docs/examples
showing how one can refactor such rules?
…On Fri, 15 Jun 2018 at 10:14 László Csomor ***@***.***> wrote:
@nlopezgi <https://github.com/nlopezgi> : Thanks for the detailed
analysis! Is there a bug we need to fix or can we close the issue?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#5397 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF7HWt2MYOYtsggdBn6B7B9akm2Huks5t817NgaJpZM4Un-IM>
.
|
@laszlocsomor Perhaps it would be good to note in the documentation for the sandbox feature that it does not trivially support cross platform builds and point to the new docs we published (particularly https://docs.bazel.build/versions/master/remote-execution-sandbox.html#troubleshooting-in-a-docker-container) other than that I think we could close. @ittaiz unfortunately, there is virtually no way to automate / make the task of tracking down which binaries your rules are using. For example, it would be extremely hard to track down that, e.g., you have a rule that invokes some shell script, and that script invokes some tool and that tool indirectly invokes a binary. Nevertheless, you can use some heuristics:
In terms of refactoring, the response we have is even more precarious (particularly for java tools), as there is no way (afaik) to refactor uses of java tools currently accessed via the local_jdk to properly enable runs from a mac. The only viable fix (imo) is to request Bazel team to deprecate the local_jdk and replace it with a refactored version of java_toolchain that includes the missing tools. |
Thanks Nick!
I’ll add two more (somewhat side) question:
Given we run with docker sand boxing and remote caching:
1. Will Bazel theoretically be able to utilize the remote cache, since the
docker sandbox is the same platform, or is the Mac in middle cause this to
be a non starter?
2. If the answer to the above is yes do you know what gaps we have for this
to be true practically?
…On Fri, 15 Jun 2018 at 19:20 Nicolas Lopez ***@***.***> wrote:
@laszlocsomor <https://github.com/laszlocsomor> Perhaps it would be good
to note in the documentation for the sandbox feature that it does not
trivially support cross platform builds and point to the new docs we
published (particularly
https://docs.bazel.build/versions/master/remote-execution-sandbox.html#troubleshooting-in-a-docker-container)
other than that I think we could close.
@ittaiz <https://github.com/ittaiz> unfortunately, there is virtually no
way to automate / make the task of tracking down which binaries your rules
are using. For example, it would be extremely hard to track down that,
e.g., you have a rule that invokes some shell script, and that script
invokes some tool and that tool indirectly invokes a binary. Nevertheless,
you can use some heuristics:
- For access to java tools, the usual culprits are rules using the
@local_jdk targets (you should be able to construct a bazel query to try to
track that?)
- After that I would search rules that use scripts and templates for
occurrences of java or java_home or strings of that sort
- For tools that are not required to run Bazel itself, you can catch
if your rules are using them by running a build inside a container as
advised here (
https://docs.bazel.build/versions/master/remote-execution-sandbox.html#troubleshooting-in-a-docker-container)
using a container that has the bare minimum set of tools installed.
In terms of refactoring, the response we have is even more precarious
(particularly for java tools), as there is no way (afaik) to refactor uses
of java tools currently accessed via the local_jdk to properly enable runs
from a mac. The only viable fix (imo) is to request Bazel team to deprecate
the local_jdk and replace it with a refactored version of java_toolchain
that includes the missing tools.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5397 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF8bhcQVEfFG6SBUXPqyRzQ8PESu5ks5t897NgaJpZM4Un-IM>
.
|
@nlopezgi - possibly this is unrealted, but I thought you should know, that by simply adding the see screenshot with 2 consecutive runs, only difference is the flag. reproduces multiple times. |
@talya the --define=EXECUTOR=remote flag allows Bazel to use a src version of ijar and singlejar (meaning that the ijar and singlejar binary get compiled in the container). In your build, the compilation of the filesystem target (https://github.com/bazelbuild/bazel/blob/master/src/main/cpp/util/BUILD#L34) is failing. This is probably one of the first c targets that is executed as part of your build. The error you are seeing indicates that you are trying to execute a binary that is not compatible with the docker container (see https://docs.bazel.build/versions/master/remote-execution-rules.html#managing-platform-dependent-binaries). Given the error executes while running a c action, my suspicion is that you are not selecting the c toolchain (via the crosstool flag) properly. The first thing you should do, is start using --verbose_failures so that you can see what command actually tries to run inside the container, from then you will need to track down if the binaries that get executed and are resulting in the error are the right ones to actually execute inside the container. |
If you are talking about having a mac host (where bazel is running) launch builds both with local docker sandbox and with a remote execution service (either backed by a local or remote cache), then yes, theoretically this should work.
The java tools (i.e., the local_jdk) is the main gap afaik (i.e., the last time I tried to get a build with local docker/re working from a mac host, this was the only blocker that I could not trivially get around) |
@nlopezgi , thanks! Would you mind doing that? |
@nlopezgi @laszlocsomor Has anything changed since this issue was created? Is it possible to run the docker spawn strategy on mac? |
There have been no changes here afaik |
Same from me, not aware of any changes. |
I believe this belongs in the configurability / platforms bucket, as this is about getting the host platform decoupled from the execution platform. |
Description of the problem / feature request:
Trying to use docker spawn strategy on Mac for java projects, results in
standard_init_linux.go:190: exec user process caused "exec format error"
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Using this sample repo
bazel test --spawn_strategy=docker --experimental_docker_image=ubuntu:latest --experimental_docker_privileged=true --experimental_enable_docker_sandbox=true --experimental_docker_verbose=true //...
succeedsERROR: /private/var/tmp/_bazel_talyas/42151487a684bdbd20cae185f8059e47/external/junit_junit/jar/BUILD.bazel:2:1: Extracting interface @junit_junit//jar:jar failed (Exit 1) standard_init_linux.go:190: exec user process caused "exec format error"
ERROR: /private/var/tmp/_bazel_talyas/42151487a684bdbd20cae185f8059e47/external/junit_junit/jar/BUILD.bazel:2:1: Extracting interface @junit_junit//jar:jar failed (Exit 1) [FATAL tini (29)] exec external/bazel_tools/tools/jdk/ijar/ijar failed: Exec format error
What operating system are you running Bazel on?
What's the output of
bazel info release
?development version, since I need the PR mentioned above in order to avoid the
The command 'chown -R -1:-1 /execroot/__main__'
errorHave you found anything relevant by searching the web?
The text was updated successfully, but these errors were encountered: