From: "Jason Pyeron" <jpyeron@pdinc.us>
To: <git@vger.kernel.org>
Subject: RE: git-upload-pack hangs
Date: Mon, 26 Sep 2016 23:45:19 -0400 [thread overview]
Message-ID: <50DEA1C222E449F59BC8488C921D6F95@black7> (raw)
In-Reply-To: <62E3FC352BE4428A90D7E4E9B137A9FB@black7>
This is a very, very first draft.
It is allowing IIS to work right now.
I still need to address chunked issues, where there is no content length (see http://www.gossamer-threads.com/lists/apache/users/373042)
Any comments, sugestions?
-Jason
--- ./origsrc/git-v2.8.3/http-backend.c 2016-05-18 18:32:41.000000000 -0400
+++ ./src/git-v2.8.3/http-backend.c 2016-09-26 22:52:02.636135000 -0400
@@ -279,14 +279,17 @@
{
size_t len = 0, alloc = 8192;
unsigned char *buf = xmalloc(alloc);
+ /* get request size */
+ size_t req_len = git_env_ulong("CONTENT_LENGTH", -1);
if (max_request_buffer < alloc)
max_request_buffer = alloc;
- while (1) {
+ while (req_len>0 || req_len==-1 ) {
+ ssize_t maxread=alloc>req_len && req_len!=-1?req_len:alloc;
ssize_t cnt;
- cnt = read_in_full(fd, buf + len, alloc - len);
+ cnt = read_in_full(fd, buf + len, maxread - len);
if (cnt < 0) {
free(buf);
return -1;
@@ -294,13 +297,19 @@
/* partial read from read_in_full means we hit EOF */
len += cnt;
- if (len < alloc) {
+ if (len < maxread) {
*out = buf;
return len;
}
+ if (req_len>0) {
+ req_len -= cnt;
+ if (req_len<0)
+ req_len=0;
+ }
+
/* otherwise, grow and try again (if we can) */
- if (alloc == max_request_buffer)
+ if (alloc == max_request_buffer && maxread == alloc)
die("request was larger than our maximum size (%lu);"
" try setting GIT_HTTP_MAX_REQUEST_BUFFER",
max_request_buffer);
@@ -310,6 +319,10 @@
alloc = max_request_buffer;
REALLOC_ARRAY(buf, alloc);
}
+
+ free(buf);
+
+ return len;
}
static void inflate_request(const char *prog_name, int out, int buffer_input)
> -----Original Message-----
> From: git-owner@vger.kernel.org
> [mailto:git-owner@vger.kernel.org] On Behalf Of Jason Pyeron
> Sent: Monday, September 26, 2016 09:26
> To: git@vger.kernel.org
> Subject: RE: git-upload-pack hangs
>
> > -----Original Message-----
> > From: Jason Pyeron
> > Sent: Monday, September 26, 2016 01:51
> >
> > git is hanging on clone. I am runnig (cygwin) git 2.8.3 on
> > IIS7 (windows server 2012 R2).
> >
> > Where can I start to perform additional debugging?
> >
>
> Reading this thread, it seems plausible as a cause since it
> aligns with my testing.
>
> http://www.spinics.net/lists/git/msg279437.html [ and
> http://www.spinics.net/lists/git/attachments/binQFGHirNLw3.bin ]
>
> I will start to trudge into the code to see if this (or
> similar) has been applied and if not, does it fix it.
>
> > Selected items I have read, but they did not help:
> >
> > http://unix.stackexchange.com/questions/98959/git-upload-pack-
> > hangs-indefinitely
> >
> > https://sparethought.wordpress.com/2012/12/06/setting-git-to-w
> ork-behind-ntlm-authenticated-proxy-cntlm-to-the-rescue/
> >
> > https://sourceforge.net/p/cntlm/bugs/24/
> >
> > invocation of the clone:
> >
> > jpyeron.adm@SERVER /tmp
> > $ GIT_TRACE=1 GIT_CURL_VERBOSE=true git clone
> > http://SERVER.domain.com/git/test.git
> > 01:23:37.020476 git.c:350 trace: built-in: git
> > 'clone' 'http://SERVER.domain.com/git/test.git'
> > Cloning into 'test'...
> > 01:23:37.206046 run-command.c:336 trace: run_command:
> > 'git-remote-http' 'origin' 'http://SERVER.domain.com/git/test.git'
> > * STATE: INIT => CONNECT handle 0x60009a140; line 1397
> > (connection #-5000)
> > * Couldn't find host SERVER.domain.com in the .netrc file;
> > using defaults
> > * Added connection 0. The cache now contains 1 members
> > * Trying ::1...
> > * TCP_NODELAY set
> > * STATE: CONNECT => WAITCONNECT handle 0x60009a140; line 1450
> > (connection #0)
> > * Connected to SERVER.domain.com (::1) port 80 (#0)
> > * STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x60009a140;
> > line 1557 (connection #0)
> > * Marked for [keep alive]: HTTP default
> > * STATE: SENDPROTOCONNECT => DO handle 0x60009a140; line 1575
> > (connection #0)
> > > GET /git/test.git/info/refs?service=git-upload-pack HTTP/1.1
> > Host: SERVER.domain.com
> > User-Agent: git/2.8.3
> > Accept: */*
> > Accept-Encoding: gzip
> > Accept-Language: en-US, *;q=0.9
> > Pragma: no-cache
> >
> > * STATE: DO => DO_DONE handle 0x60009a140; line 1654 (connection #0)
> > * STATE: DO_DONE => WAITPERFORM handle 0x60009a140; line 1781
> > (connection #0)
> > * STATE: WAITPERFORM => PERFORM handle 0x60009a140; line 1791
> > (connection #0)
> > * HTTP 1.1 or later with persistent connection, pipelining supported
> > < HTTP/1.1 200 OK
> > < Cache-Control: no-cache, max-age=0, must-revalidate
> > < Pragma: no-cache
> > < Content-Type: application/x-git-upload-pack-advertisement
> > < Expires: Fri, 01 Jan 1980 00:00:00 GMT
> > * Server Microsoft-IIS/8.5 is not blacklisted
> > < Server: Microsoft-IIS/8.5
> > < X-Powered-By: ASP.NET
> > < Date: Mon, 26 Sep 2016 05:23:37 GMT
> > * Marked for [closure]: Connection: close used
> > < Connection: close
> > < Content-Length: 310
> > <
> > * STATE: PERFORM => DONE handle 0x60009a140; line 1955
> (connection #0)
> > * multi_done
> > * Curl_http_done: called premature == 0
> > * Closing connection 0
> > * The cache now contains 0 members
> > 01:23:37.688252 run-command.c:336 trace: run_command:
> > 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack'
> > '--thin' '--check-self-contained-and-connected' '--cloning'
> > 'http://SERVER.domain.com/git/test.git/'
> > 01:23:37.717168 exec_cmd.c:120 trace: exec: 'git'
> > 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack'
> > '--thin' '--check-self-contained-and-connected' '--cloning'
> > 'http://SERVER.domain.com/git/test.git/'
> > 01:23:37.749820 git.c:350 trace: built-in: git
> > 'fetch-pack' '--stateless-rpc' '--stdin' '--lock-pack'
> > '--thin' '--check-self-contained-and-connected' '--cloning'
> > 'http://SERVER.domain.com/git/test.git/'
> > * STATE: INIT => CONNECT handle 0x60009a140; line 1397
> > (connection #-5000)
> > * Couldn't find host SERVER.domain.com in the .netrc file;
> > using defaults
> > * Added connection 1. The cache now contains 1 members
> > * Hostname SERVER.domain.com was found in DNS cache
> > * Trying ::1...
> > * TCP_NODELAY set
> > * STATE: CONNECT => WAITCONNECT handle 0x60009a140; line 1450
> > (connection #1)
> > * Connected to SERVER.domain.com (::1) port 80 (#1)
> > * STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x60009a140;
> > line 1557 (connection #1)
> > * Marked for [keep alive]: HTTP default
> > * STATE: SENDPROTOCONNECT => DO handle 0x60009a140; line 1575
> > (connection #1)
> > > POST /git/test.git/git-upload-pack HTTP/1.1
> > Host: SERVER.domain.com
> > User-Agent: git/2.8.3
> > Accept-Encoding: gzip
> > Content-Type: application/x-git-upload-pack-request
> > Accept: application/x-git-upload-pack-result
> > Content-Length: 140
> >
> > * upload completely sent off: 140 out of 140 bytes
> > * STATE: DO => DO_DONE handle 0x60009a140; line 1654 (connection #1)
> > * STATE: DO_DONE => WAITPERFORM handle 0x60009a140; line 1781
> > (connection #1)
> > * STATE: WAITPERFORM => PERFORM handle 0x60009a140; line 1791
> > (connection #1)
>
> --
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> - -
> - Jason Pyeron PD Inc. http://www.pdinc.us -
> - Principal Consultant 10 West 24th Street #100 -
> - +1 (443) 269-1555 x333 Baltimore, Maryland 21218 -
> - -
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
>
>
next prev parent reply other threads:[~2016-09-27 3:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <66A60DA77398CD439FA676CEF593977D692508@exchange.1.internal.pdinc.us>
2016-09-26 13:26 ` git-upload-pack hangs Jason Pyeron
2016-09-27 3:45 ` Jason Pyeron [this message]
[not found] ` <CAPc5daVdnuEfgNaeaGCymd3QWX7kfO3JQutVWmPOv1iMMzqCcA@mail.gmail.com>
2016-09-27 10:27 ` Jason Pyeron
2016-09-27 16:02 ` Junio C Hamano
2016-09-27 20:56 ` Jason Pyeron
2016-09-26 5:51 Jason Pyeron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50DEA1C222E449F59BC8488C921D6F95@black7 \
--to=jpyeron@pdinc.us \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).