uv
uv copied to clipboard
`uv add` and `uv lock` sometimes hang before exiting
I can reproduce this on my machine running uv cache clean && uv venv && uv add jupyter. I've also noticed this with uv lock.
https://github.com/astral-sh/uv/assets/34988408/4ffd54df-4514-4761-9421-3f850e90f488
Samply doesn't seem to point to anything being done in that time.
I've encountered a consistent hang when there's a circular dependency in the lock file.
name = "foo"
version = "0.1.0"
requires-python = ">=3.9"
dependencies = ["poetry"]
When I run uv lock followed by uv add flask, the process hangs indefinitely.
Did a little digging myself and I found a loop in the lock.rs file that appears to cause the issue. Adding a check to skip the loop iteration if the key already exists in the map seems to fix the problem for me.
https://github.com/astral-sh/uv/blob/796171e1e6d55dae095effebb6d815ac91727c2c/crates/uv-resolver/src/lock.rs#L354-L380
@blueraft Thanks for the report. I've isolated the issue with uv add jupyter to a bug in our Tokio code where we can't exit until timing out. Can you open a separate issue for the infinite hang with cyclic dependencies?