Commit 2f3da8d
Fix race condition by removing directory deletion before rename
Remove the remove_dir_all_force call before rename to avoid race condition where:
1. Thread A removes target_dir
2. Thread B removes target_dir (ignored due to NotFound)
3. Thread B renames tmp to target_dir
4. Thread A tries to rename and gets AlreadyExists
Now we just attempt the rename directly, which is more atomic. If it fails with AlreadyExists,
we know another thread succeeded and we handle it gracefully by validating/fixing the installation.
Co-authored-by: fengmk2 <156269+fengmk2@users.noreply.github.com>1 parent b537b34 commit 2f3da8d
1 file changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
381 | 381 | | |
382 | 382 | | |
383 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
384 | 387 | | |
385 | | - | |
386 | 388 | | |
387 | | - | |
388 | | - | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
0 commit comments