{"thread":{"id":"46081","subject":"Git Daemon on Windows fatal error.","startedAt":"2017-05-31T19:16:34Z","lastAt":"2017-06-01T06:53:36Z","messageCount":2,"participants":["Hector Santos","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"321157","messageId":"592F153A.7020403@isdg.net","threadId":"46081","inReplyTo":null,"subject":"Git Daemon on Windows fatal error.","fromName":"Hector Santos","fromEmail":"hsantos@isdg.net","sentAt":"2017-05-31T19:10:50Z","receivedAt":"2017-05-31T19:16:34Z","isPatch":false,"sender":{"key":"hsantos@isdg.net","avatar":null},"body":"Hi, I am relatively new to GIT (coming from CVS and SVN) and I am \ntrying to setup \"Git Daemon\" on windows.\n\nI got it working for Local network communications:\n\nd:\\local\\wc5\\testgit>git clone git://localhost/http clone10\nCloning into 'clone10'...\nremote: Counting objects: 526, done.\nremote: Compressing objects: 100% (520/520), done.\nReceiving objects: 100% (526/526), 1.38 MiB | 0 bytes/s, done.\nremote: Total 526 (delta 81), reused 0 (delta 0)\nResolving deltas: 100% (81/81), done.\n\nbut it fails over the wire when using the public host domain:\n\nd:\\local\\wc5\\testgit>git clone git://public.example.dom/http clone11\nCloning into 'clone11'...\nremote: Counting objects: 526, done.\nremote: Compressing objects: 100% (520/520), done.\nremote: Total 526 (delta 81), reused 0 (delta 0)\nfatal: read error: Invalid argument\nfatal: early EOF\nfatal: index-pack failed\n\nSometimes its a different initial fatal error but generally the same.  \nOnce or twice, a repeat MAY work, but often not.\n\nShort of digging into the git source code, I did as much research \nonline and tried the various config options suggestions, changing the \npacket size, etc, to no avail.\n\nTo me, this seems like a \"Socket Half Close\" problem.   If anyone is \naware of what appears to be a long time \"known\" problem, and have a \nreal solution, it would be greatly appreciated.   Otherwise, I am very \ninteresting in exploring the Half Close solution as I've seen similar \nbehavior in other internet hosting servers in the past.   A simple \nclosesocket() wrapper funciton did the trick:\n\n\n// HalfCloseSocket() performs a TCP Half Close by calling shutdown()\n// which signals the remote that no more data is going to be\n// sent (FIN signal). HalfCloseSocket() then goes into a\n// recv() loop to wait for the remote to acknowledge the close.\n// This acknowledgment comes as a recv() return value\n// of zero (less).\n\nBOOL HalfCloseSocket(SOCKET socket)\n{\n     if (shutdown(socket,SD_SENT) != 0) {\n         return FALSE;\n     }\n     int ret = 0;\n     int msecs = 10; // poor man sanity check\n     char buf[8*1024];\n     while ((ret = recv(socket, buf,sizeof(buf),0)) > 0) {\n         buf[0] = 0;\n         buf[1] = 0;\n         msecs--;\n         if (msecs == 0) break;\n     }\n     return closesocket(socket);\n}\n\nWhile I rather not get into the source, I am willing to explore the \neffort if there is no other option.\n\nThanks for any input you can provide\n\nHector Santos\nSantronics Software, Inc.\n\n-- \nHLS\n\n\n\n"},{"id":"321252","messageId":"4bf5ba9b-9a41-847a-9a59-df9d1f987637@web.de","threadId":"46081","inReplyTo":"592F153A.7020403@isdg.net","subject":"Re: Git Daemon on Windows fatal error.","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2017-06-01T06:53:42Z","receivedAt":"2017-06-01T06:53:36Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"\n\nOn 31/05/17 21:10, Hector Santos wrote:\n> Hi, I am relatively new to GIT (coming from CVS and SVN) and I am trying to \n> setup \"Git Daemon\" on windows.\n> \n> I got it working for Local network communications:\n> \n> d:\\local\\wc5\\testgit>git clone git://localhost/http clone10\n> Cloning into 'clone10'...\n> remote: Counting objects: 526, done.\n> remote: Compressing objects: 100% (520/520), done.\n> Receiving objects: 100% (526/526), 1.38 MiB | 0 bytes/s, done.\n> remote: Total 526 (delta 81), reused 0 (delta 0)\n> Resolving deltas: 100% (81/81), done.\n> \n> but it fails over the wire when using the public host domain:\n> \n> d:\\local\\wc5\\testgit>git clone git://public.example.dom/http clone11\n> Cloning into 'clone11'...\n> remote: Counting objects: 526, done.\n> remote: Compressing objects: 100% (520/520), done.\n> remote: Total 526 (delta 81), reused 0 (delta 0)\n> fatal: read error: Invalid argument\n> fatal: early EOF\n> fatal: index-pack failed\n> \n> Sometimes its a different initial fatal error but generally the same. Once or \n> twice, a repeat MAY work, but often not.\n[] snip\n\nFirst of all, welcome to Git.\nSecond, which version of Git are you using ? And which version of Windows ?\nThird, I don't think that this has to do with Git Daemon.\n        When I look at \"read error: Invalid argument\", it may be fixed in the\n        latest version.\n        And that why it is important to know the version you are using.\n\nAnd, there is a special place to report problems with Git for Windows:\nhttps://github.com/git-for-windows/git/wiki (hope I got it right),\nbut please feel free to continue here on the mailing list.\n\n"}]}