)]}'
{
  "commit": "8896d2e211c57453359566c4520615c1c1f75b66",
  "tree": "05b8d52d6a254800377f1e9d479acae5584a348a",
  "parents": [
    "76eb2a4ef5747ef881f4a3d2d1e3338e4ef8913f"
  ],
  "author": {
    "name": "ulfjack",
    "email": "ulfjack@google.com",
    "time": "Fri Jan 19 02:55:21 2018 -0800"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-piper@google.com",
    "time": "Fri Jan 19 02:56:58 2018 -0800"
  },
  "message": "Prevent broken cache entries on concurrent file changes\n\nLocal execution has an inherent race condition: if a user modifies a file while an action is executed, then it is impossible for Bazel to tell which version of the file was actually read during action execution. The file may have been modified before or after the tool has read it, or, in the worst case, the tool may have read both the original and the modified version. In addition, the file may be changed back to the original state before Bazel can check the file, so computing the digest before / after may not be sufficient.\n\nThis is a concern for both local and remote caches, although the cost of poisoning a shared remote cache is significantly higher, and is what has triggered this work.\n\nFixes #3360.\n\nWe solve this by keeping a reference to the FileContentsProxy, and using that to check for modificaitons before storing the cache entry. We output a warning if this check fails.\n\nThis change does not increase memory consumption; Java objects are always allocated in multiples of 8 bytes, we use compressed oops, and the FileArtifactValue currently has 12 bytes worth of fields (excl. object overhead), so adding another pointer is effectively free.\n\nAs a possible performance optimization on purely local builds, we could also consider not computing digests at all, and only use the FileContentsProxy for caching.\n\nPiperOrigin-RevId: 182510358\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c393332fe31c70f63cdb52dd2c088757efacbc3f",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/exec/SingleBuildFileCache.java",
      "new_id": "76479d037716b2a2530b7a20f6c872ab8771f9a2",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/exec/SingleBuildFileCache.java"
    },
    {
      "type": "modify",
      "old_id": "b9b1f55d798c4cce0cfa5d2e857f7caf2a3e27d8",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java",
      "new_id": "21ab0a5d0b1a8e8e2e87145237850938511f94ed",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteOptions.java"
    },
    {
      "type": "modify",
      "old_id": "e8af197907c4471d781ad02642f8549e09af5d92",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java",
      "new_id": "04977ed157dfdc513581185ec11aaac5412b837b",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/remote/RemoteSpawnCache.java"
    },
    {
      "type": "modify",
      "old_id": "627184df447aace927d112e6580b6ffc85543b90",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java",
      "new_id": "2fe2b69ef296008c1b934c85c2c1f746c9355fa1",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/skyframe/ArtifactFunction.java"
    },
    {
      "type": "modify",
      "old_id": "06b2aefcc9bf5aa4f2e20c41cb4d7664d7debf60",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/skyframe/FileArtifactValue.java",
      "new_id": "aaba2245dc1cd4f3ffe7198cd492794a12ca6680",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/skyframe/FileArtifactValue.java"
    },
    {
      "type": "modify",
      "old_id": "dd37b3cfbda1dc0e4f9ba5d3b8226bbac51ecbf5",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/remote/FakeActionInputFileCache.java",
      "new_id": "c4c09ab068cf9dff15f52f2de143e71940627274",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/remote/FakeActionInputFileCache.java"
    },
    {
      "type": "modify",
      "old_id": "ccf282243f5a3f35e2d706bfc27c1f7f5aa6d589",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/skyframe/FileArtifactValueTest.java",
      "new_id": "7637abd3ba73305239756150d37903cf3feaaa60",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/skyframe/FileArtifactValueTest.java"
    },
    {
      "type": "modify",
      "old_id": "3c32a9df3d759a676aa74e7026ec91ba19d3e6dd",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactMetadataTest.java",
      "new_id": "4e3b242b5d8aa29d4354c20ca0cdb41c2e4c22f5",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/skyframe/TreeArtifactMetadataTest.java"
    }
  ]
}
