Avoid deadlocks when multiple uv processes lock resources (#6790)

This is achieved by updating the `LockedFile::acquire` API to be async —
as in some cases we were attempting to acquire the lock synchronously,
i.e., without yielding, which blocked the runtime.

Closes https://github.com/astral-sh/uv/issues/6691 — I tested with the
reproduction there and a local release build and no longer reproduce the
deadlock with these changes.

Some additional context in the [internal Discord
thread](https://discord.com/channels/1039017663004942429/1278430431204741270/1278478941262188595)
This commit is contained in:
Zanie Blue
2024-08-29 11:16:14 -05:00
committed by GitHub
parent 4f5356ed55
commit e3d5d3d26d
19 changed files with 58 additions and 39 deletions
+1 -1
View File
@@ -124,7 +124,7 @@ impl PythonInstallation {
let installations = ManagedPythonInstallations::from_settings()?.init()?;
let installations_dir = installations.root();
let cache_dir = installations.cache();
let _lock = installations.acquire_lock()?;
let _lock = installations.lock().await?;
let download = ManagedPythonDownload::from_request(&request)?;
let client = client_builder.build();