Skip to content

Commit c24e106

Browse files
authored
[Beta-1.89] Fix potential deadlock in CacheState::lock (#15699)
Beta backports - 0b362e3 (#15698) In order to make CI pass, the following PRs are also cherry-picked: --- Problem has been around since 1.75 but significant enough for us to aim for 6 weeks of testing instead of 12.
2 parents 84709f0 + e41465a commit c24e106

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cargo/util/cache_lock.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,10 @@ impl CacheState {
408408
.lock_exclusive(gctx, DOWNLOAD_EXCLUSIVE_DESCR, blocking)
409409
{
410410
Ok(LockAcquired) => {}
411-
Ok(WouldBlock) => return Ok(WouldBlock),
411+
Ok(WouldBlock) => {
412+
self.mutate_lock.decrement();
413+
return Ok(WouldBlock);
414+
}
412415
Err(e) => {
413416
self.mutate_lock.decrement();
414417
return Err(e);

0 commit comments

Comments
 (0)