Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel checkout fails to unlik directories #3904

Closed
1 task done
vagabundmw opened this issue Jun 20, 2022 · 6 comments
Closed
1 task done

Parallel checkout fails to unlik directories #3904

vagabundmw opened this issue Jun 20, 2022 · 6 comments

Comments

@vagabundmw
Copy link

When parallel checkout is enabled, Git checkout and related commands error out.

  • I was not able to find an open or closed issue matching what I'm seeing

#1442 produces similar error messages but is probably not related to parallel checkout.

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

git version 2.36.1.windows.1
cpu: x86_64
built from commit: e2ff68a2d1426758c78d023f863bfa1e03cbc768
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
feature: fsmonitor--daemon
  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

Microsoft Windows [Version 10.0.19044.1766]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
$ cat /etc/install-options.txt

Editor Option: VisualStudioCode
Custom Editor Path:
Default Branch Option:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: OpenSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: MinTTY
Git Pull Behavior Option: Rebase
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable Pseudo Console Support: Enabled
Enable FSMonitor: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I've enabled parallel checkout:

git config checkout.workers 8

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

Bash

# I Use CPython just as an example.
$ git clone https://github.com/python/cpython.git --depth=1
$ cd cpython

# Just for test purposes. I change the working dir in a significant way, 
# so that we have something to restore.
$ rm -rf Lib

# When I enable parallel checkout, the following restore will fail.
# The exact number does not matter.
# The bug does not appear with just a single checkout worker process.
$ git config checkout.workers 8

$ git restore Lib
Unlink of file 'Lib' failed. Should I try again? (y/n) 

$ git checkout -- Lib
Unlink of file 'Lib/ctypes' failed. Should I try again? (y/n) 


  • What did you expect to occur after running these commands?

No failure to restore the working directory: all removed files restored.

  • What actually happened instead?

A failure to to restore the working directory "Unlink of file '...' failed". The exact directory from the error message varies per invocation, i.e., is not fully predicable.

This was only observable on three independent Windows 10 machines. I could not identify any third party SW that could be related to this issue. I could not reproduce on Linux (Raspbian, Fedora). Windows Defender is active, but disabling it did not affect this issue.

The error message does not show up during sequential checkout, that is, with Git config option checkout.workers =1.

@dscho
Copy link
Member

dscho commented Jun 20, 2022

# I Use CPython just as an example.

Could you please construct a smaller example that still reproduces the issue?

@vagabundmw
Copy link
Author

OK, here's a smaller example. starting from an empty repo with a single dir/subdir/file tree entry. I was not able to reproduce with anything smaller.

# Create a fresh repo with with just one file under dir/subdir.
$ mkdir repo && cd $_
$ git init
$ mkdir -p dir/subdir && touch dir/subdir/file
$ git add dir && git commit -m "Add test data"

# Enable parallel checkout, which causes the following checkout / restore to fail.
$ git config checkout.workers 2

# Force a checkout of the test data, which fails in Git 2.36.1.
$ rm -rf dir
$ git restore dir
$ git checkout -- dir

@dscho
Copy link
Member

dscho commented Jun 22, 2022

Excellent. With this example, I can reproduce locally and am investigating now.

@dscho
Copy link
Member

dscho commented Jun 22, 2022

Performance Tweaks FSCache: Enabled

Ah. It's this one again. If you run git -c core.FSCache=false restore dir, it works...

@dscho
Copy link
Member

dscho commented Jun 22, 2022

@vagabundmw could you kindly test either the installer or portable Git at https://github.com/git-for-windows/git/actions/runs/2544507139#artifacts?

@dscho dscho closed this as completed in dc97ff0 Jun 23, 2022
@vagabundmw
Copy link
Author

@dscho, I can confirm the fix is working fine. Thank you for your work!

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

No branches or pull requests

3 participants
@dscho @vagabundmw and others