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

Remote: Add --experimental_capture_corrupted_outputs flag. #13568

Closed

Conversation

coeuvre
Copy link
Member

@coeuvre coeuvre commented Jun 10, 2021

Which when set, Bazel will save outputs whose digest does not match the expected value to the target directories.

Also use OutputDigestMismatchException to indicate the error and include output path in the error message. The message for such an error will become e.g.:

com.google.devtools.build.lib.remote.common.OutputDigestMismatchException: Output bazel-out/darwin-fastbuild/bin/output.txt download failed: Expected digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229' does not match received digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229'.

Used to support bazelbuild/continuous-integration#1175.

…set, Bazel will save outputs whose digest does not match the expected value to the target directories.
@google-cla google-cla bot added the cla: yes label Jun 10, 2021
@coeuvre coeuvre requested a review from philwo June 10, 2021 10:22
@coeuvre coeuvre self-assigned this Jun 10, 2021
@coeuvre coeuvre added the team-Remote-Exec Issues and PRs for the Execution (Remote) team label Jun 10, 2021
try {
String outputPath = ((OutputDigestMismatchException) suppressed).getOutputPath();
Path localPath = ((OutputDigestMismatchException) suppressed).getLocalPath();
Path dst = captureCorruptedOutputsDir.getRelative(outputPath);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it guaranteed (even with broken or malicious backends) that the output path will never contain .. references or start with a /? Should we check that the resulting path dst is still below the captureCorruptedOutputsDir just to make sure? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are safe here since outputPath is what we obtained from skyframe and send to remote execution backend (something like bazel-out/darwin-fastbuild/bin/...).

It is a path relative to the working directory (or input root depends on the flags) when the remote backend executing the action.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I added the check in case the invariance changed in the future. Thanks for the catch!

@bazel-io bazel-io closed this in 4ca8946 Jun 10, 2021
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
Which when set, Bazel will save outputs whose digest does not match the expected value to the target directories.

Also use OutputDigestMismatchException to indicate the error and include output path in the error message. The message for such an error will become e.g.:

```
com.google.devtools.build.lib.remote.common.OutputDigestMismatchException: Output bazel-out/darwin-fastbuild/bin/output.txt download failed: Expected digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229' does not match received digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229'.
```

Used to support bazelbuild/continuous-integration#1175.

Closes bazelbuild#13568.

PiperOrigin-RevId: 378624823
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
Which when set, Bazel will save outputs whose digest does not match the expected value to the target directories.

Also use OutputDigestMismatchException to indicate the error and include output path in the error message. The message for such an error will become e.g.:

```
com.google.devtools.build.lib.remote.common.OutputDigestMismatchException: Output bazel-out/darwin-fastbuild/bin/output.txt download failed: Expected digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229' does not match received digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229'.
```

Used to support bazelbuild/continuous-integration#1175.

Closes bazelbuild#13568.

PiperOrigin-RevId: 378624823
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
Which when set, Bazel will save outputs whose digest does not match the expected value to the target directories.

Also use OutputDigestMismatchException to indicate the error and include output path in the error message. The message for such an error will become e.g.:

```
com.google.devtools.build.lib.remote.common.OutputDigestMismatchException: Output bazel-out/darwin-fastbuild/bin/output.txt download failed: Expected digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229' does not match received digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229'.
```

Used to support bazelbuild/continuous-integration#1175.

Closes bazelbuild#13568.

PiperOrigin-RevId: 378624823
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 15, 2021
Which when set, Bazel will save outputs whose digest does not match the expected value to the target directories.

Also use OutputDigestMismatchException to indicate the error and include output path in the error message. The message for such an error will become e.g.:

```
com.google.devtools.build.lib.remote.common.OutputDigestMismatchException: Output bazel-out/darwin-fastbuild/bin/output.txt download failed: Expected digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229' does not match received digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229'.
```

Used to support bazelbuild/continuous-integration#1175.

Closes bazelbuild#13568.

PiperOrigin-RevId: 378624823
coeuvre added a commit to coeuvre/bazel that referenced this pull request Jul 16, 2021
Which when set, Bazel will save outputs whose digest does not match the expected value to the target directories.

Also use OutputDigestMismatchException to indicate the error and include output path in the error message. The message for such an error will become e.g.:

```
com.google.devtools.build.lib.remote.common.OutputDigestMismatchException: Output bazel-out/darwin-fastbuild/bin/output.txt download failed: Expected digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229' does not match received digest '872af2fe77729717832d0a020ae87a93b8b944146a2af6b3490491e1eaf1dc74/29229'.
```

Used to support bazelbuild/continuous-integration#1175.

Closes bazelbuild#13568.

PiperOrigin-RevId: 378624823
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes team-Remote-Exec Issues and PRs for the Execution (Remote) team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants