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

git for Windows hangs when pushing a 10-character change to git-daemon #2824

Closed
1 task done
gh-andre opened this issue Sep 19, 2020 · 10 comments
Closed
1 task done

Comments

@gh-andre
Copy link

gh-andre commented Sep 19, 2020

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

#2328 is similar, but it appears to be fixed in a past version.

Setup

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

64-bit

$ git --version --build-options

git version 2.28.0.windows.1
cpu: x86_64
built from commit: 77982caf269b7ee713a76da2bcf260c34d3bf7a7
sizeof-long: 4
sizeof-size_t: 8
shell-path: /bin/sh
  • 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.19041.508]
  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

Editor Option: Nano
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: WinSSL
CRLF Option: CRLFCommitAsIs
Bash Terminal Option: ConHost
Git Pull Behavior Option: Merge
Use Credential Manager: Core
Performance Tweaks FSCache: Disabled
Enable Symlinks: Disabled
Enable Pseudo Console Support: Disabled
  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

I'm running git-daemon - latest available on Fedora 30 (2.21.3). Git version on that machine:

git version 2.21.3
cpu: i686
no commit associated with this build
sizeof-long: 4
sizeof-size_t: 4

Tried the same on an x64 CentOS, same result, so it's not the CPU arch. git-daemon is running as xinetd with this setup:

service git
{
	port		= 9418
	socket_type	= stream
	protocol	= tcp
	wait		= no
	user		= nobody
	passenv		=
	server		= /usr/bin/git
	server_args	= daemon --inetd --export-all --enable=upload-pack --enable=upload-archive --enable=receive-pack --base-path=/git
}

Running git-daemon from the command line doesn't change anything - same behavior.

Created a repository and committed a 10-character file with a newline (for xinetd changed owner, but for command line ran as root):

git init test --bare
chown -R nobody:nobody test

On a Linux client:

git clone git://git/test
cd test
vi a.txt
git add a.txt
git commit -m a.txt
git push

Pushed the change just fine. After this ran clone/change on Windows, as described below. Added another line of 10 characters. The entire log on Windows before git push was:

git log --graph --all --patch

* commit 277a505d49d2a94c6397d6feae9836f8d933ca9a (HEAD -> master)
| Author: Windows User <user@windows>
| Date:   Sat Sep 19 14:04:50 2020 -0400
|
|     Added a line to a.txt
|
| diff --git a/a.txt b/a.txt
| index 2bebc2f..8f44092 100644
| --- a/a.txt
| +++ b/a.txt
| @@ -1,2 +1,4 @@
|  1234567890
| +1234567890
| +
|
|
* commit 3b1867d4f825dc1d9179e6b1ba3722e6e18b3128 (origin/master, origin/HEAD)
  Author: root <user@fedora>
  Date:   Sat Sep 19 13:52:06 2020 -0400

      Added a.txt

  diff --git a/a.txt b/a.txt
  new file mode 100644
  index 0000000..2bebc2f
  --- /dev/null
  +++ b/a.txt
  @@ -0,0 +1,2 @@
  +1234567890
  +

git push produced this output and continue hanging after the last line:

git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Writing objects: 100% (3/3)

I ran Wireshark and these are the packets sent between machines (192.168.1.101 is Windows and 192.168.1.96 is Linux, SYN's and ACK's are omitted):

132	36.727864	192.168.1.101	192.168.1.96	Git	90	Git Smart Protocol

00000000  30 30 32 34 67 69 74 2d  72 65 63 65 69 76 65 2d   0024git- receive-
00000010  70 61 63 6b 20 2f 74 65  73 74 00 68 6f 73 74 3d   pack /te st.host=
00000020  67 69 74 00                                        git.

134	36.742322	192.168.1.96	192.168.1.101	Git	197	Git Smart Protocol

    00000000  30 30 38 66 33 62 31 38  36 37 64 34 66 38 32 35   008f3b18 67d4f825
    00000010  64 63 31 64 39 31 37 39  65 36 62 31 62 61 33 37   dc1d9179 e6b1ba37
    00000020  32 32 65 36 65 31 38 62  33 31 32 38 20 72 65 66   22e6e18b 3128 ref
    00000030  73 2f 68 65 61 64 73 2f  6d 61 73 74 65 72 00 72   s/heads/ master.r
    00000040  65 70 6f 72 74 2d 73 74  61 74 75 73 20 64 65 6c   eport-st atus del
    00000050  65 74 65 2d 72 65 66 73  20 73 69 64 65 2d 62 61   ete-refs  side-ba
    00000060  6e 64 2d 36 34 6b 20 71  75 69 65 74 20 61 74 6f   nd-64k q uiet ato
    00000070  6d 69 63 20 6f 66 73 2d  64 65 6c 74 61 20 61 67   mic ofs- delta ag
    00000080  65 6e 74 3d 67 69 74 2f  32 2e 32 31 2e 33 0a      ent=git/ 2.21.3.

136	36.782836	192.168.1.96	192.168.1.101	Git	60	Git Smart Protocol

    0000008F  30 30 30 30                                        0000

137	36.783838	192.168.1.101	192.168.1.96	Git	213	Git Smart Protocol

00000024  30 30 39 66 33 62 31 38  36 37 64 34 66 38 32 35   009f3b18 67d4f825
00000034  64 63 31 64 39 31 37 39  65 36 62 31 62 61 33 37   dc1d9179 e6b1ba37
00000044  32 32 65 36 65 31 38 62  33 31 32 38 20 32 37 37   22e6e18b 3128 277
00000054  61 35 30 35 64 34 39 64  32 61 39 34 63 36 33 39   a505d49d 2a94c639
00000064  37 64 36 66 65 61 65 39  38 33 36 66 38 64 39 33   7d6feae9 836f8d93
00000074  33 63 61 39 61 20 72 65  66 73 2f 68 65 61 64 73   3ca9a re fs/heads
00000084  2f 6d 61 73 74 65 72 00  20 72 65 70 6f 72 74 2d   /master.  report-
00000094  73 74 61 74 75 73 20 73  69 64 65 2d 62 61 6e 64   status s ide-band
000000A4  2d 36 34 6b 20 61 67 65  6e 74 3d 67 69 74 2f 32   -64k age nt=git/2
000000B4  2e 32 38 2e 30 2e 77 69  6e 64 6f 77 73 2e 31      .28.0.wi ndows.1

139	36.784380	192.168.1.101	192.168.1.96	Git	58	Git Smart Protocol

000000C3  30 30 30 30                                        0000

After that, no additional packets sent for as long as I waited. No errors in the git-daemon log. Just says that it started processing and there is no EXIT log line.

Tried a couple of other Linux clients and they work just fine against the same git-daemon, so it appears to be a Windows client issue.

Details

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

cmd

git clone git://git/test
cd test
notepad a.txt
git add a.txt
git commit -m "a.txt"
git push
  • What did you expect to occur after running these commands?

New commit pushed to git-daemon

  • What actually happened instead?

git is hanging indefinitely

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

** insert URL here **

@gh-andre
Copy link
Author

gh-andre commented Sep 20, 2020

Tried one more thing. I use hggit Mercurial extension to push my Mercurial repositories to Git, so I imported that same test repository described above and pushed it to the same git-daemon while running Wireshark. The push worked as expected and here's the difference in the frame after which Git on Windows hangs:

hggit - working

00000024  30 30 38 64 33 62 31 38  36 37 64 34 66 38 32 35   008d3b18 67d4f825
00000034  64 63 31 64 39 31 37 39  65 36 62 31 62 61 33 37   dc1d9179 e6b1ba37
00000044  32 32 65 36 65 31 38 62  33 31 32 38 20 32 37 37   22e6e18b 3128 277
00000054  61 35 30 35 64 34 39 64  32 61 39 34 63 36 33 39   a505d49d 2a94c639
00000064  37 64 36 66 65 61 65 39  38 33 36 66 38 64 39 33   7d6feae9 836f8d93
00000074  33 63 61 39 61 20 72 65  66 73 2f 68 65 61 64 73   3ca9a re fs/heads
00000084  2f 6d 61 73 74 65 72 00  72 65 70 6f 72 74 2d 73   /master. report-s
00000094  74 61 74 75 73 20 73 69  64 65 2d 62 61 6e 64 2d   tatus si de-band-
000000A4  36 34 6b 20 6f 66 73 2d  64 65 6c 74 61            64k ofs- delta
000000B1  30 30 30 30                                        0000
000000B5  50 41 43 4b                                        PACK
... data ...

Git for Windows - not working

00000024  30 30 39 66 33 62 31 38  36 37 64 34 66 38 32 35   009f3b18 67d4f825
00000034  64 63 31 64 39 31 37 39  65 36 62 31 62 61 33 37   dc1d9179 e6b1ba37
00000044  32 32 65 36 65 31 38 62  33 31 32 38 20 32 37 37   22e6e18b 3128 277
00000054  61 35 30 35 64 34 39 64  32 61 39 34 63 36 33 39   a505d49d 2a94c639
00000064  37 64 36 66 65 61 65 39  38 33 36 66 38 64 39 33   7d6feae9 836f8d93
00000074  33 63 61 39 61 20 72 65  66 73 2f 68 65 61 64 73   3ca9a re fs/heads
00000084  2f 6d 61 73 74 65 72 00  20 72 65 70 6f 72 74 2d   /master.  report-    <-- extra space
00000094  73 74 61 74 75 73 20 73  69 64 65 2d 62 61 6e 64   status s ide-band
000000A4  2d 36 34 6b 20 61 67 65  6e 74 3d 67 69 74 2f 32   -64k age nt=git/2
000000B4  2e 32 38 2e 30 2e 77 69  6e 64 6f 77 73 2e 31      .28.0.wi ndows.1
000000C3  30 30 30 30                                        0000

Notice the extra space character in front of report-status in the Git for Windows frame, which follows a terminating null character and appears to be out of place, as it doesn't separate anything. Wonder if it throws a byte count somewhere and triggers this bug. Just a thought.

@dscho
Copy link
Member

dscho commented Sep 21, 2020

Thank you for this excellent bug report!

This issue looks as if it could have the same root cause as #907, with the workaround described here:

The workaround, which is shown in the code but not in the thread itself, is to do:

git config --global sendpack.sideband false

Does that help?

@gh-andre
Copy link
Author

I suspected concurrency and tried to set the number of threads to 1 and it didn't help, but didn't dig deep enough to find this workaround. Thanks for pointing it out. Yes, it does work.

Thanks for a quick reply. Keep up the good work!

@dscho
Copy link
Member

dscho commented Sep 28, 2020

@gh-andre could I ask you to open a PR to edit the Known Issues to mention this problem as well as its work-around? That would help me a lot, as I am busy with too many other things until v2.29.0 gets released.

@gh-andre
Copy link
Author

@dscho Sure. If a day or two is not a problem for you, I can add a bullet point.

@dscho
Copy link
Member

dscho commented Sep 28, 2020

Thank you!

@gh-andre
Copy link
Author

@dscho I added a PR, but it doesn't look like I will be fixing the DCO issue - I have a couple of logins on this machine and don't want to mess with sign-off settings for this account. You can just grab the one-liner from the PR and delete the PR after.

@dscho
Copy link
Member

dscho commented Sep 29, 2020

Sadly, that re-adds my burden. I'll just take care of this when I get around to it.

@dscho
Copy link
Member

dscho commented Sep 29, 2020

Okay, with this addition to the known issues, I think we can leave it to #907 to be resolved, and close this here ticket.

@dscho dscho closed this as completed Sep 29, 2020
@gh-andre
Copy link
Author

Sounds good. Will keep an eye on #907. Sorry for the extra legwork.

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

2 participants