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

bazel aquery returns same ActionKey even when file contents have changed #11718

Open
indragiek opened this issue Jul 6, 2020 · 6 comments
Open
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Documentation Documentation improvements that cannot be directly linked to other team labels team-Performance Issues for Performance teams type: bug type: documentation (cleanup)

Comments

@indragiek
Copy link

indragiek commented Jul 6, 2020

Description of the problem / feature request:

When running bazel aquery for a target, the actions that take source files as inputs show an ActionKey that does not change even when the contents of one or more input source files has changed. I would expect the ActionKey to be a different hash when the contents have changed.

This seems to me like either user error on my part, or a bug with aquery, because I have not seen this result in a stale build where changes don't get picked up.

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

I have a minimal repro project here:
action_key_repro.zip

Running bazel aquery 'deps(//:foo)' --nohost_deps --notool_deps --noimplicit_deps gives me the output with the following for the "Compiling lib/print.cpp" action:

action 'Compiling lib/print.cpp'
  Mnemonic: CppCompile
  Target: //:lib
  Configuration: darwin-fastbuild
  ActionKey: 544ad9739062047cec3cafbf7fc5e0c3e865c2087f427c38c8b8d9f7aec63c5a
  Inputs: [bazel-out/darwin-fastbuild/internal/_middlemen/_S_S_Clib-BazelCppSemantics_build_arch_darwin-fastbuild, bazel-out/host/internal/_middlemen/external_Slocal_Uconfig_Ucc_Cosx_Utools_Udarwin_Ux86_U64, external/bazel_tools/tools/cpp/grep-includes.sh, lib/print.cpp]
  Outputs: [bazel-out/darwin-fastbuild/bin/_objs/lib/print.d, bazel-out/darwin-fastbuild/bin/_objs/lib/print.o]
  ExecutionInfo: {requires-darwin: '', supports-xcode-requirements-set: ''}
  Command Line: (exec external/local_config_cc/wrapped_clang \
...

If I then modify lib/print.cpp by changing the "hello world" string to something else and save it, re-running bazel aquery as described above gives me the exact same output, with the same ActionKey.

What operating system are you running Bazel on?

macOS 10.15.5

What's the output of bazel info release?

release 3.3.1

Have you found anything relevant by searching the web?

  • I found the --check_up_to_date option -- bazel build --check_up_to_date //:foo correctly reports that it is out of date after I change lib/print.cpp, so this works as expected even when the ActionKey doesn't change
  • Doing a bazel build or bazel shutdown prior to re-checking the output of bazel aquery does not help

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

Minimal repro project: action_key_repro.zip

@gregestren gregestren added team-Performance Issues for Performance teams type: bug untriaged labels Jul 7, 2020
@meisterT
Copy link
Member

meisterT commented Jul 8, 2020

cc @joeleba

@meisterT meisterT added P2 We'll consider working on this in future. (Assignee optional) type: documentation (cleanup) and removed untriaged labels Jul 8, 2020
@sdtwigg
Copy link
Contributor

sdtwigg commented Jul 8, 2020

The documentation of that use of the term ActionKey is referred to here:

Roughly, that checksum encapsulates all the information about the actual command to be run by that action but specifically does not incorporate the contents of the input files involved in the action. (Other parts of the action caching mechanism will verify those details).

Thus, this is technically working as intended. I don't think aquery has to actually execute actions but incorporating the contents into that checksum would require this. (As well as have potential performance impact.)

@joeleba
Copy link
Member

joeleba commented Jul 8, 2020

Stephen has answered the question. But this shows that we need to update aquery's documentation to be explicit about what this ActionKey attribute covers.

@indragiek
Copy link
Author

Thank you for the clarification! Is there a way to get what I'm looking for here -- a hash that accounts for the contents of the input files?

bazel-io pushed a commit that referenced this issue Jul 10, 2020
Original Issue: #11718

RELNOTES: None
PiperOrigin-RevId: 320557905
@burdiyan
Copy link

burdiyan commented Nov 2, 2022

Just got hit by this. This was a surprised behavior for something called an ActionKey. Is there a way to obtain the actual RemoteCache::ActionKey for a target by using some of the Bazel's querying facilities?

@benjaminp
Copy link
Collaborator

No—the feature request for it is #7962.

@keertk keertk added the team-Documentation Documentation improvements that cannot be directly linked to other team labels label Jan 10, 2023
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-Documentation Documentation improvements that cannot be directly linked to other team labels team-Performance Issues for Performance teams type: bug type: documentation (cleanup)
Projects
None yet
Development

No branches or pull requests

8 participants