Skip to content

minimal download breaks stable-status #8385

Closed

Description

@aherrmann

Description of the problem:

The minimal download flags

build --experimental_inmemory_jdeps_files
build --experimental_inmemory_dotd_files
build --experimental_remote_download_outputs=minimal

on Bazel 0.25.2 seem to break the stable-status feature. I'm observing the following error

ERROR: Failed to run workspace status command bazel_tools/workspace_status.sh: /home/aj/.cache/bazel/_bazel_aj/10d2a8446c92e5dc655eb18c02f185fb/execroot/com_github_digital_asset_daml/bazel-out/stable-status.txt (Permission denied)

(Forcefully removing the file temporarily resolves the problem.)

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

Checkout digital-asset/daml@f6642ff and execute the following commands

. .envrc
bazel run //:buildifier
echo >> WORKSPACE
git add WORKSPACE
git commit -m 'dummy change'
bazel run //:buildifier

What operating system are you running Bazel on?

OpenSUSE Tumbleweed 20190510

What's the output of bazel info release?

release 0.25.2- (@Non-Git)

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

Using Nix

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

Not sure if related or not, but bazel run seems to be not working on some targets when using minimal downloads. E.g. on the same commit as above

$ bazel run damlc
...
ERROR: Non-existent or non-executable /home/aj/.cache/bazel/_bazel_aj/10d2a8446c92e5dc655eb18c02f185fb/execroot/com_github_digital_asset_daml/bazel

Activity

  1. added
    team-Remote-Exec
    untriaged
    on May 21, 2019
  2. removed
    untriaged
    on May 22, 2019
  3. added a commit that references this issue on Jun 19, 2019
    b3c3ca8
  4. added a commit that references this issue on Jun 23, 2019
    f044b1f
  5. added a commit that references this issue on Jul 4, 2019
    d2884b0
  6. added a commit that references this issue on Jul 15, 2019
    bf3dd2d
  7. mattklein123 commented on Aug 15, 2019

    @mattklein123

    FYI I'm still hitting this issue on bazel 0.28.1. Is there anything I can do to provide more info? When I manually delete the workspace file everything works fine.

  8. mattklein123 commented on Aug 16, 2019

    @mattklein123

    I verified that the above fix is in 0.28.1 so I guess it's some other issue. @buchgr LMK if you would like me to open a fresh issue on this.

  9. reopened this on Aug 16, 2019
  10. buchgr commented on Aug 16, 2019

    @buchgr
    Contributor

    Do you have a reproducer or is it the same as the initial bug report?

  11. mattklein123 commented on Aug 16, 2019

    @mattklein123

    @buchgr I don't have an exact reproducer, but the symptom is exactly the same as the original bug report. Let me know if there is any info I can provide. I've gotten around it right now by just deleting the stable-status.txt file before I run any build commands. I can remove that hack and help debug if you tell me what to look for.

  12. aherrmann commented on Aug 20, 2019

    @aherrmann
    ContributorAuthor

    @buchgr I can still reproduce the issue with the same steps given in the original issue above on current master of digital-asset/daml@f11e09f60f. This is using

    $ bazel version
    Build label: 0.28.1- (@non-git)
    Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
    Build time: Tue Jan 1 00:00:00 1980 (315532800)
    Build timestamp: 315532800
    Build timestamp as int: 315532800
    

    built with Nix as defined in the same repository.

  13. emfree commented on Aug 25, 2019

    @emfree

    We ran into this as well. Not very familiar with the internals here, but it looks like the issue possibly goes like this:

    • The BazelWorkspaceStatusModule calls FileSystemUtils.maybeUpdateContent on the stable-status file:
      // Only update the stableStatus contents if they are different than what we have on disk.
      // This is to preserve the old file's mtime so that we do not generate an unnecessary dirty
      // file on each incremental build.
      FileSystemUtils.maybeUpdateContent(
      actionExecutionContext.getInputPath(stableStatus), printStatusMap(stableMap));
    • This in turn is a delete-plus-create on the file:
      if (!outputFile.isWritable()) {
      outputFile.delete();
      }
      writeContent(outputFile, newContent);
      }
    • But when you have experimental_remote_download_actions=minimal, the delete doesn't actually happen.
    • This is because the delete is being handled by the RemoteActionFileSystem, which looks to have a simple typo in its delete() method, fixed with this patch:
    diff --git a/src/main/java/com/google/devtools/build/lib/remote/RemoteActionFileSystem.java b/src/main/java/com/google/devtools/build/lib/remote/RemoteActionFileSystem.java
    index 0491c2d954..6157b413a5 100644
    --- a/src/main/java/com/google/devtools/build/lib/remote/RemoteActionFileSystem.java
    +++ b/src/main/java/com/google/devtools/build/lib/remote/RemoteActionFileSystem.java
    @@ -69,7 +69,7 @@ public class RemoteActionFileSystem extends DelegateFileSystem {
       @Override
       public boolean delete(Path path) throws IOException {
         RemoteFileArtifactValue m = getRemoteInputMetadata(path);
    -    if (m != null) {
    +    if (m == null) {
           return super.delete(path);
         }
         return true;
    

    @buchgr does this seem reasonable?

  14. buchgr commented on Aug 27, 2019

    @buchgr
    Contributor

    @emfree it does. nice catch! send me a patch? :)

  15. added a commit that references this issue on Aug 29, 2019
    73d5346
  16. added a commit that references this issue on Sep 6, 2019
    1b60d75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

team-Remote-Exectype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions