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

build without the bytes: "dangling symbolic link" error for symlink output #19143

Closed
william-smith-skydio opened this issue Aug 1, 2023 · 6 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug

Comments

@william-smith-skydio
Copy link

Description of the bug:

I have an action with an output that is a symlink to another output of the same action. When build without the bytes is enabled (e.g. --remote_download_toplevel or --remote_download_minimal), the symlink gets downloaded, but the target does not, resulting in bazel failing due to a "dangling symbolic link".

What category does this issue belong to?

Remote Execution

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

This is a simple action which produces two outputs, one of which is a symlink to the other:

genrule(
    name = "foobar",
    outs = [
        "a",
        "b",
    ],
    cmd = "touch $(location a) && ln -s a $(location b)",
)

This succeeds and populates the disk cache:

bazel build //:foobar --disk_cache /tmp/cache --remote_download_toplevel

Then this fails:

bazel clean
bazel build //:foobar --disk_cache /tmp/cache --remote_download_toplevel

Error:

ERROR: /<redacted>/BUILD.bazel:1:8: declared output 'b' is a dangling symbolic link
ERROR: /<redacted>/BUILD.bazel:1:8: Executing genrule //:foobar failed: not all outputs were created or valid

The output directory contains just a broken b symlink, no a in sight.

Which operating system are you running Bazel on?

Ubuntu 18.04

What is the output of bazel info release?

6.3.1

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

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.

This reproduces in bazel 6.3.0 and 6.3.1, but not in 6.2.1 or 7.0.0-pre.20230710.5.

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

I have shown an example with a genrule and disk cache, but this also reproduces with a rule with declared outputs and a proper remote cache setup.

@coeuvre
Copy link
Member

coeuvre commented Aug 2, 2023

This has been fixed by Bazel@HEAD and due to massive changes to BwoB recently, it's unlikely we can cherry-pick the fix to 6.x.

cc @tjgq

@brentleyjones
Copy link
Contributor

@coeuvre Would a localized fix be possible? The report says that it only broke in 6.3.x, but 6.2.1 worked, so this is minor release regression?

@tjgq
Copy link
Contributor

tjgq commented Aug 2, 2023

@brentleyjones I will take a look to see if a simple fix is possible.

@tjgq tjgq added P2 We'll consider working on this in future. (Assignee optional) and removed untriaged labels Aug 8, 2023
@tjgq tjgq self-assigned this Aug 8, 2023
@joeljeske
Copy link
Contributor

6.4 is slated to go out soon. Is there any update on the feasibility of fixing this 6.x regression?

tjgq added a commit to tjgq/bazel that referenced this issue Oct 5, 2023
…bytes.

This appears to have worked in 6.2.x, got broken in 6.3.x, and is working
again at head. The divergence is too great at this point, so it's not possible
to cherry-pick the necessary changes from head. Instead, I've written a
targeted fix that falls back to downloading every target output if at least
one of the outputs was materialized as a symlink.

Fixes bazelbuild#19143.
tjgq added a commit to tjgq/bazel that referenced this issue Oct 6, 2023
…bytes.

This appears to have worked in 6.2.x, got broken in 6.3.x, and is working
again at head. The divergence is too great at this point, so it's not possible
to cherry-pick the necessary changes from head. Instead, I've written a
targeted fix that falls back to downloading every target output if at least
one of the outputs was materialized as a symlink.

Fixes bazelbuild#19143.
tjgq added a commit to tjgq/bazel that referenced this issue Oct 6, 2023
…bytes.

This appears to have worked in 6.2.x, got broken in 6.3.x, and is working
again at head. The divergence is too great at this point, so it's not possible
to cherry-pick the necessary changes from head. Instead, I've written a
targeted fix that falls back to downloading every target output if at least
one of the outputs was materialized as a symlink.

Fixes bazelbuild#19143.
iancha1992 pushed a commit that referenced this issue Oct 6, 2023
…bytes. (#19739)

This appears to have worked in 6.2.x, got broken in 6.3.x, and is
working again at head. The divergence is too great at this point, so
it's not possible to cherry-pick the relevant changes from head.
Instead, I've written a targeted fix that falls back to downloading
every action output if at least one of the outputs was materialized as a
symlink.

Fixes #19143.
@tjgq
Copy link
Contributor

tjgq commented Oct 6, 2023

A fix has been submitted into the 6.4.0 release branch.

@tjgq tjgq closed this as completed Oct 6, 2023
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 6.4.0 RC2. Please test out the release candidate and report any issues as soon as possible. Thanks!

tjgq added a commit to tjgq/bazel that referenced this issue Dec 1, 2023
…ilding without the bytes.

This is the same bug as bazelbuild#19143, except that the fix in 3a48457 missed the case
where the symlink occurs inside an output directory.

Fixes bazelbuild#20408.
tjgq added a commit to tjgq/bazel that referenced this issue Dec 7, 2023
…ilding without the bytes.

This is the same bug as bazelbuild#19143, except that the fix in 3a48457 missed the case
where the symlink occurs inside an output directory.

Fixes bazelbuild#20408.
tjgq added a commit to tjgq/bazel that referenced this issue Dec 7, 2023
…ilding without the bytes.

This is the same bug as bazelbuild#19143, except that the fix in 3a48457 missed the case
where the symlink occurs inside an output directory.

Fixes bazelbuild#20408.
Wyverald pushed a commit that referenced this issue Dec 7, 2023
…ilding without the bytes. (#20409)

This is the same bug as #19143, except that the fix in 3a48457 missed
the case where the symlink occurs inside an output directory.

Fixes #20408.
Gormo added a commit to Gormo/bazel that referenced this issue Jan 24, 2024
…bytes.

This appears to have worked in 6.2.x, got broken in 6.3.x, and is working
again at head. The divergence is too great at this point, so it's not possible
to cherry-pick the necessary changes from head. Instead, I've written a
targeted fix that falls back to downloading every target output if at least
one of the outputs was materialized as a symlink.

Fixes bazelbuild#19143.
Gormo added a commit to Gormo/bazel that referenced this issue Jan 24, 2024
…bytes.

This appears to have worked in 6.2.x, got broken in 6.3.x, and is working
again on main but is not mapped to 7.0.x.
The divergence is too great at this point, so it's not possible
to cherry-pick the necessary changes from head. Instead, I've written a
targeted fix that falls back to downloading every target output if at least
one of the outputs was materialized as a symlink.

Fixes bazelbuild#19143.
Gormo pushed a commit to Gormo/bazel that referenced this issue Jan 24, 2024
…bytes.

This appears to have worked in 6.2.x, got broken in 6.3.x, and is working
again on main but is not mapped to 7.0.x.
The divergence is too great at this point, so it's not possible
to cherry-pick the necessary changes from head. Instead, I've written a
targeted fix that falls back to downloading every target output if at least
one of the outputs was materialized as a symlink.

Fixes bazelbuild#19143.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Remote-Exec Issues and PRs for the Execution (Remote) team type: bug
Projects
None yet
Development

No branches or pull requests

8 participants