Skip to content

fix(uv): avoid deadlocks while initializing UV_VENV#4609

Merged
jdx merged 3 commits intojdx:mainfrom
risu729:fix-uv-venv-deadlock
Mar 12, 2025
Merged

fix(uv): avoid deadlocks while initializing UV_VENV#4609
jdx merged 3 commits intojdx:mainfrom
risu729:fix-uv-venv-deadlock

Conversation

@risu729
Copy link
Copy Markdown
Contributor

@risu729 risu729 commented Mar 11, 2025

Fixes #4600.

UV_VENV initialization somtimes cause a deadlock in some cases because it requires loading path or env to get the toolset.

This PR avoids the deadlock by using Mutex and returning None while initializing itself.

Comment thread src/uv.rs
@jdx jdx merged commit 26d203a into jdx:main Mar 12, 2025
@risu729 risu729 deleted the fix-uv-venv-deadlock branch March 12, 2025 02:42
ldrouard pushed a commit to ldrouard/mise that referenced this pull request Mar 12, 2025
@risu729
Copy link
Copy Markdown
Contributor Author

risu729 commented Mar 18, 2025

I'm sorry for my mistake. I assumed my fix worked, but it actually does not. This PR does not resolve the deadlock.

I misunderstood the root cause, a deadlock occurring during initialization, so using Mutex inside of LazyLock does not fix the issue.

I will continue working on this.

@jdx
Copy link
Copy Markdown
Owner

jdx commented Mar 18, 2025

is it because you need cross-process locking? if so, have a look at https://github.com/jdx/mise/blob/main/src/lock_file.rs

risu729 added a commit to risu729/mise that referenced this pull request Mar 26, 2025
risu729 added a commit to risu729/mise that referenced this pull request Apr 20, 2025
risu729 added a commit to risu729/mise that referenced this pull request Apr 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

npm backend hangs when used with python.uv_venv_auto = true

2 participants