)]}'
{
  "commit": "e461085397668903cfefca3d0746e422bf99c18d",
  "tree": "c14d4460484a9d8badef846a6dd74e82c5dab3a5",
  "parents": [
    "3b987a77a95815fe2b46cd39c04b8f38e35a1178"
  ],
  "author": {
    "name": "jingwen",
    "email": "jingwen@google.com",
    "time": "Mon Oct 26 22:38:26 2026 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Mon Oct 26 22:42:07 2026 -0700"
  },
  "message": "Cancel pending invalidation lookup futures when `AnalysisCacheInvalidator.lookupKeysToInvalidate()` does not complete normally.\n\nWhen `AnalysisCacheInvalidator.lookupKeysToInvalidate()` times out, encounters an `ExecutionException`, or is interrupted while submitting or waiting for responses, it falls back to invalidating all keys (`Futures.allAsList(futures).get(...)` only cancels the combined `ListFuture` wrapper on timeout/interruption, which does not propagate cancellation to the input futures unless they are explicitly cancelled). Leaving the individual lookup futures uncancelled keeps their `SkycacheChannelStateAdvisor` in-flight request tokens acquired and allows orphaned invalidation RPCs and buffered batch entries to remain active after the invalidation check has already given up.\n\nBefore:\n```java\ntry {\n  List\u003cListenableFuture\u003cOptional\u003cSkyKey\u003e\u003e\u003e futures \u003d\n      submitInvalidationLookupsBatched(keysToLookup);\n  ...\n  keysToInvalidate \u003d\n      Futures.allAsList(futures).get(INVALIDATION_TIMEOUT_SECONDS, SECONDS).stream()\n          .flatMap(Optional::stream)\n          .collect(toImmutableSet());\n  status \u003d InvalidationLookupMetrics.Status.OK;\n} catch (TimeoutException e) {\n  status \u003d InvalidationLookupMetrics.Status.TIMED_OUT;\n  return keysToLookup;\n} finally {\n  stopwatch.stop();\n  ...\n}\n```\n\nAfter:\n```java\nList\u003cListenableFuture\u003cOptional\u003cSkyKey\u003e\u003e\u003e futures \u003d null;\ntry {\n  futures \u003d submitInvalidationLookupsBatched(keysToLookup);\n  ...\n} finally {\n  if (futures !\u003d null \u0026\u0026 status !\u003d InvalidationLookupMetrics.Status.OK) {\n    cancelFutures(futures);\n  }\n  stopwatch.stop();\n  ...\n}\n```\n\nCancelling the submitted `ListenableFuture` instances in `finally` when `status !\u003d InvalidationLookupMetrics.Status.OK` (and when batch submission itself times out or is interrupted) propagates cancellation through `Futures.transform` / `Futures.transformAsync` to the underlying `analysisCacheClient.lookup()` futures immediately, releasing their in-flight request tokens.\n\nPiperOrigin-RevId: 1007822773\nChange-Id: I4fc0a25d576418fae428f16c0fb313ad643d8bd5\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "9b31d93e54af854f4071e282789feea55c2564b3",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/skyframe/serialization/analysis/AnalysisCacheInvalidator.java",
      "new_id": "d368f435585f72084816b97dcb66ca904a42a3bf",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/skyframe/serialization/analysis/AnalysisCacheInvalidator.java"
    },
    {
      "type": "modify",
      "old_id": "9989f1f2eea98d94e18c98e60c0b90054d676df5",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/skyframe/serialization/analysis/AnalysisCacheInvalidatorTest.java",
      "new_id": "e237b17de9cae32ccd0eb33385a680fa448e7b3c",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/skyframe/serialization/analysis/AnalysisCacheInvalidatorTest.java"
    }
  ]
}
