Git Daemon on Windows fatal error.
- From
- Hector Santos <hsantos@isdg.net>
- Date
- May 31, 2017, 19:10 UTC
- Message-ID
- <592F153A.7020403@isdg.net>
Hi, I am relatively new to GIT (coming from CVS and SVN) and I am trying to setup "Git Daemon" on windows.
I got it working for Local network communications:
d:\local\wc5\testgit>git clone git://localhost/http clone10 Cloning into 'clone10'... remote: Counting objects: 526, done. remote: Compressing objects: 100% (520/520), done. Receiving objects: 100% (526/526), 1.38 MiB | 0 bytes/s, done. remote: Total 526 (delta 81), reused 0 (delta 0) Resolving deltas: 100% (81/81), done.
but it fails over the wire when using the public host domain:
d:\local\wc5\testgit>git clone git://public.example.dom/http clone11 Cloning into 'clone11'... remote: Counting objects: 526, done. remote: Compressing objects: 100% (520/520), done. remote: Total 526 (delta 81), reused 0 (delta 0) fatal: read error: Invalid argument fatal: early EOF fatal: index-pack failed
Sometimes its a different initial fatal error but generally the same. Once or twice, a repeat MAY work, but often not.
Short of digging into the git source code, I did as much research online and tried the various config options suggestions, changing the packet size, etc, to no avail.
To me, this seems like a "Socket Half Close" problem. If anyone is aware of what appears to be a long time "known" problem, and have a real solution, it would be greatly appreciated. Otherwise, I am very interesting in exploring the Half Close solution as I've seen similar behavior in other internet hosting servers in the past. A simple closesocket() wrapper funciton did the trick:
// HalfCloseSocket() performs a TCP Half Close by calling shutdown() // which signals the remote that no more data is going to be // sent (FIN signal). HalfCloseSocket() then goes into a // recv() loop to wait for the remote to acknowledge the close. // This acknowledgment comes as a recv() return value // of zero (less).
BOOL HalfCloseSocket(SOCKET socket)
{
if (shutdown(socket,SD_SENT) != 0) {
return FALSE;
}
int ret = 0;
int msecs = 10; // poor man sanity check
char buf[8*1024];
while ((ret = recv(socket, buf,sizeof(buf),0)) > 0) {
buf[0] = 0;
buf[1] = 0;
msecs--;
if (msecs == 0) break;
}
return closesocket(socket);
}While I rather not get into the source, I am willing to explore the effort if there is no other option.
Thanks for any input you can provide
Hector Santos Santronics Software, Inc.
-- HLS