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

experimental_sibling_repository_layout seems to create remote execution actions with invalid working_directory/output relationships #13188

Closed
illicitonion opened this issue Mar 9, 2021 · 3 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug

Comments

@illicitonion
Copy link
Contributor

Description of the problem / feature request:

When testing out an unrelated feature, using remote execution (with buildbarn), I ran into issues where Bazel errored that it could not compile DumpPlatformClassPath.class because:

JavaToolchainCompileClasses tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class failed: not all outputs were created or valid

I'm running in a workspace with name example_all.

As far as I can tell, this error is because on the Command we're setting working_directory: example_all but also prefixing the output_files with example_all/, for example the output_files for my execution is example_all/bazel-out/bazel_tools/darwin-fastbuild/bin/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class.

The remote execution API specifies that output_files should be relative to the working_directory, rather than relative to the input_root, so I believe this prefixing shouldn't be happening. See this section of the remote API spec:

https://github.com/bazelbuild/remote-apis/blob/0943dc4e70e1414735a85a3167557392c177ff45/build/bazel/remote/execution/v2/remote_execution.proto#L547-L551

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Run a buildbarn cluster, and try to build any Java with --experimental_sibling_repository_layout=true.

What operating system are you running Bazel on?

The Bazel client is on macOS, the buildbarn cluster is running Ubuntu Focal.

What's the output of bazel info release?

development version

If bazel info release returns "development version" or "(@non-git)", tell us how you built Bazel.

Checked out f182645 and ran bazel build //src:bazel

If I revert 7149f57 this error goes away (though others are introduced), so I'll cc @lberki who may have some thoughts :)

@lberki
Copy link
Contributor

lberki commented Mar 10, 2021

This is probably because RBE has a bug where the output directory is interpreted relative to input_root instead of according to the spec, so this is what Bazel did.

@eytankidron, do I understand correctly that if Bazel makes it so that output file paths are relative to working_directory, it will keep working with RBE since it's been partially fixed there?

@coeuvre , can you take this?

@lberki lberki added team-Remote-Exec Issues and PRs for the Execution (Remote) team P2 We'll consider working on this in future. (Assignee optional) labels Mar 10, 2021
@eytankidron
Copy link

@lberki that is correct. This bug is now fixed in RBE. Sending output paths relative to the working directory will now work.

@ulfjack
Copy link
Contributor

ulfjack commented Mar 10, 2021

Changing this now is a breaking change for remote execution for users that are using --experimental_sibling_repository_layout.

@coeuvre coeuvre added P1 I'll work on this now. (Assignee required) type: bug and removed P2 We'll consider working on this in future. (Assignee optional) labels Mar 11, 2021
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 13, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory.

When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 13, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory. When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible. execRoot usages in RemoteCache are all replaced.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 13, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory. When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible. execRoot usages in RemoteCache are all replaced.

On Windows, shared action results cache for cl.exe across different workspaces causing header dependency checking to fail. This was initially fixed by bazelbuild#9172, but is broken after cl/356735700. The reason test didn't fail is two builds from different workspaces do not share the cache since input files are relative to the parent of exec root which contains workspace name. This change fixes that by adding workspace name as platform property for action running on Windows.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 14, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory. When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible. execRoot usages in RemoteCache are all replaced.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 14, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory. When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible. execRoot usages in RemoteCache are all replaced.

On Windows, shared action results cache for cl.exe across different workspaces causing header dependency checking to fail. This was initially fixed by bazelbuild#9172, but is broken after cl/356735700. The reason test didn't fail is two builds from different workspaces do not share the cache since input files are relative to the parent of exec root which contains workspace name. This change fixes that by adding workspace name as platform property for action running on Windows.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 19, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory. When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible. execRoot usages in RemoteCache are all replaced.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Apr 19, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory. When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible. execRoot usages in RemoteCache are all replaced.

On Windows, shared action results cache for cl.exe across different workspaces causing header dependency checking to fail. This was initially fixed by bazelbuild#9172, but is broken after cl/356735700. The reason test didn't fail is two builds from different workspaces do not share the cache since input files are relative to the parent of exec root which contains workspace name. This change fixes that by adding workspace name as platform property for action running on Windows.

Fixes bazelbuild#13188.
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 15, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory.

When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible in remote module. execRoot usages in RemoteCache are all replaced.

On Windows, shared action results cache for cl.exe across different workspaces causing header dependency checking to fail. This was initially fixed by bazelbuild#9172, but is broken after bazelbuild@24c980b. The reason test didn't fail before this change is that two builds from different workspaces do not share the cache since input files are relative to the parent of exec root which contains workspace name. This change fixes that by adding workspace name as platform property for action running on Windows.

Fixes bazelbuild#13188.

Closes bazelbuild#13339.

PiperOrigin-RevId: 369168230
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 15, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory.

When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible in remote module. execRoot usages in RemoteCache are all replaced.

On Windows, shared action results cache for cl.exe across different workspaces causing header dependency checking to fail. This was initially fixed by bazelbuild#9172, but is broken after bazelbuild@24c980b. The reason test didn't fail before this change is that two builds from different workspaces do not share the cache since input files are relative to the parent of exec root which contains workspace name. This change fixes that by adding workspace name as platform property for action running on Windows.

Fixes bazelbuild#13188.

Closes bazelbuild#13339.

PiperOrigin-RevId: 369168230
coeuvre added a commit to coeuvre/bazel that referenced this issue Jul 16, 2021
…y default.

When --experimental_sibling_external_layout is set, use the parent directory of execRoot as input root and set working directory to the base name of execRoot. Paths of output files are relative to working directory.

When --incompatible_remote_paths_relative_to_input_root is set, paths of output files are relative to input root.

Introduce RemotePathResolver which is used to convert local paths to remote paths and vice versa. We should prefer this class instead of using execRoot directly whenever possible in remote module. execRoot usages in RemoteCache are all replaced.

On Windows, shared action results cache for cl.exe across different workspaces causing header dependency checking to fail. This was initially fixed by bazelbuild#9172, but is broken after bazelbuild@24c980b. The reason test didn't fail before this change is that two builds from different workspaces do not share the cache since input files are relative to the parent of exec root which contains workspace name. This change fixes that by adding workspace name as platform property for action running on Windows.

Fixes bazelbuild#13188.

Closes bazelbuild#13339.

PiperOrigin-RevId: 369168230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants