Skip to content

Commit 22c782d

Browse files
bazel-iocoeuvre
andauthored
[8.2.0] Fix a deadlock when using --remote_cache_async and HTTP cache. (#25788)
Fixes #25232. Closes #25786. PiperOrigin-RevId: 745164203 Change-Id: I58cc9f83b6c6cc8cb2c728cfe132e220a7678cea Commit 06455bb Co-authored-by: Chi Wang <coeuvre@gmail.com>
1 parent b14b557 commit 22c782d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/com/google/devtools/build/lib/remote/RemoteExecutionService.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,9 +1864,13 @@ public void uploadOutputs(RemoteAction action, SpawnResult spawnResult, Runnable
18641864
cacheResource -> {
18651865
Profiler.instance()
18661866
.completeTask(startTime.get(), ProfilerTask.UPLOAD_TIME, "upload outputs");
1867-
backgroundTaskPhaser.arriveAndDeregister();
18681867
onUploadComplete.run();
1868+
// Release the cache first before arriving the backgroundTaskPhaser. Otherwise,
1869+
// the release here could make the reference count reach zero and close the
1870+
// cache, resulting in a deadlock when using HTTP cache.
1871+
// See https://github.com/bazelbuild/bazel/issues/25232.
18691872
cacheResource.release();
1873+
backgroundTaskPhaser.arriveAndDeregister();
18701874
},
18711875
/* eager= */ false)
18721876
.subscribeOn(scheduler)

0 commit comments

Comments
 (0)