git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* http.postBuffer set at the server side?
@ 2013-08-28 23:08 Pyeron, Jason J CTR (US)
  2013-08-29  3:52 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Pyeron, Jason J CTR (US) @ 2013-08-28 23:08 UTC (permalink / raw)
  To: git@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]

We have systems hosting git which are behind proxies, and unless the client sets the http.postBuffer to a large size they connections fails.

Is there a way to set this on the server side? If not would a patch be possible to fix this?

jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
$ git push remote --all
Username for 'https://server.fqdn':
Password for 'https://jpyeron@server.fqdn':
Counting objects: 1820, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1276/1276), done.
error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
Writing objects: 100% (1820/1820), 17.72 MiB | 5.50 MiB/s, done.
Total 1820 (delta 527), reused 26 (delta 6)
fatal: The remote end hung up unexpectedly

jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
$ git config http.postBuffer 524288000

jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
$ git push remote --all
Username for 'https://server.fqdn':
Password for 'https://jpyeron@server.fqdn':
Counting objects: 1820, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1276/1276), done.
Writing objects: 100% (1820/1820), 17.72 MiB | 11.31 MiB/s, done.
Total 1820 (delta 519), reused 26 (delta 6)
To https://server.fqdn/git/netasset-portal/
 * [new branch]      master -> master


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5615 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: http.postBuffer set at the server side?
  2013-08-28 23:08 http.postBuffer set at the server side? Pyeron, Jason J CTR (US)
@ 2013-08-29  3:52 ` Jeff King
  2013-08-29  4:40   ` Jason Pyeron
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2013-08-29  3:52 UTC (permalink / raw)
  To: Pyeron, Jason J CTR (US); +Cc: git@vger.kernel.org

On Wed, Aug 28, 2013 at 11:08:02PM +0000, Pyeron, Jason J CTR (US) wrote:

> We have systems hosting git which are behind proxies, and unless the
> client sets the http.postBuffer to a large size they connections
> fails.
> 
> Is there a way to set this on the server side? If not would a patch be
> possible to fix this?

What would it mean to set it on the server?  It is the size at which the
client decides to use a "chunked" transfer-encoding rather than
buffering the whole output to send at once. So you'd want to figure out
why the server is upset about the chunked encoding.

> jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
> $ git push remote --all
> Username for 'https://server.fqdn':
> Password for 'https://jpyeron@server.fqdn':
> Counting objects: 1820, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (1276/1276), done.
> error: RPC failed; result=22, HTTP code = 411
> fatal: The remote end hung up unexpectedly
> Writing objects: 100% (1820/1820), 17.72 MiB | 5.50 MiB/s, done.
> Total 1820 (delta 527), reused 26 (delta 6)
> fatal: The remote end hung up unexpectedly

The server (or the proxy) returns 411, complaining that it didn't get a
Content-Length header. That's because the git http client doesn't know
how big the content is ahead of time (and that's kind of the point of
chunked encoding; the content is streamed).

> jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
> $ git config http.postBuffer 524288000
> 
> jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
> $ git push remote --all
> Username for 'https://server.fqdn':
> Password for 'https://jpyeron@server.fqdn':
> Counting objects: 1820, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (1276/1276), done.
> Writing objects: 100% (1820/1820), 17.72 MiB | 11.31 MiB/s, done.
> Total 1820 (delta 519), reused 26 (delta 6)
> To https://server.fqdn/git/netasset-portal/
>  * [new branch]      master -> master

And here you've bumped the buffer to 500MB, so git will potentially
buffer that much in memory before sending anything. Which works for your
17MB packfile, as we buffer the whole thing and then send the exact size
ahead of time, appeasing the proxy.

But there are two problems I see with just bumping the postBuffer value:

  1. You've just postponed the problem. The first 501MB push will fail
     again. You can bump it higher, but you may eventually hit a point
     where your buffer is too big to fit in RAM.

  2. You've lost the pipelining. With a small postBuffer, we are
     streaming content up to the server as pack-objects generates it.
     But with a large buffer, we generate all of the content, then start
     sending the first byte (notice how the progress meter, which is
     generated by pack-objects, shows twice as fast in the second case.
     It is not measuring the network at all, but is streaming into
     git-remote-https's buffer).

If the server really insists on a content-length header, then we can't
ever fix (2). But we could fix (1) by spooling the packfile to disk and
then sending from there (under the assumption that you have way more
temporary disk space than RAM).

However, if you have control of the proxies, the best thing would be to
tweak its config to stop complaining about a lack of content-length
header (at least in cases where you're getting a "chunked"
content-transfer-encoding). That would solve both issues (and without
clients having to change anything).

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: http.postBuffer set at the server side?
  2013-08-29  3:52 ` Jeff King
@ 2013-08-29  4:40   ` Jason Pyeron
  2013-08-29  6:31     ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Jason Pyeron @ 2013-08-29  4:40 UTC (permalink / raw)
  To: 'Jeff King'; +Cc: git

> -----Original Message-----
> From: Jeff King
> Sent: Wednesday, August 28, 2013 23:52
> To: Pyeron, Jason J CTR (US)
> Cc: git@vger.kernel.org
> Subject: Re: http.postBuffer set at the server side?
> 
> On Wed, Aug 28, 2013 at 11:08:02PM +0000, Pyeron, Jason J CTR 
> (US) wrote:
> 
> > We have systems hosting git which are behind proxies, and 
> unless the 
> > client sets the http.postBuffer to a large size they connections 
> > fails.
> > 
> > Is there a way to set this on the server side? If not would 
> a patch be 
> > possible to fix this?
> 
> What would it mean to set it on the server?  It is the size 
> at which the client decides to use a "chunked" 

To tell the client...

> transfer-encoding rather than buffering the whole output to 
> send at once. So you'd want to figure out why the server is 
> upset about the chunked encoding.
> 

Unchangable settings in a specific case here.

> > jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
> > $ git push remote --all
> > Username for 'https://server.fqdn':
> > Password for 'https://jpyeron@server.fqdn':
> > Counting objects: 1820, done.
> > Delta compression using up to 4 threads.
> > Compressing objects: 100% (1276/1276), done.
> > error: RPC failed; result=22, HTTP code = 411
> > fatal: The remote end hung up unexpectedly Writing objects: 100% 
> > (1820/1820), 17.72 MiB | 5.50 MiB/s, done.
> > Total 1820 (delta 527), reused 26 (delta 6)
> > fatal: The remote end hung up unexpectedly
> 
> The server (or the proxy) returns 411, complaining that it 
> didn't get a Content-Length header. That's because the git 
> http client doesn't know how big the content is ahead of time 
> (and that's kind of the point of chunked encoding; the 
> content is streamed).
> 
> > jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
> > $ git config http.postBuffer 524288000
> > 
> > jason.pyeron@hostname /home/jason.pyeron/desktop/projectname
> > $ git push remote --all
> > Username for 'https://server.fqdn':
> > Password for 'https://jpyeron@server.fqdn':
> > Counting objects: 1820, done.
> > Delta compression using up to 4 threads.
> > Compressing objects: 100% (1276/1276), done.
> > Writing objects: 100% (1820/1820), 17.72 MiB | 11.31 MiB/s, done.
> > Total 1820 (delta 519), reused 26 (delta 6) To 
> > https://server.fqdn/git/netasset-portal/
> >  * [new branch]      master -> master
> 
> And here you've bumped the buffer to 500MB, so git will 
> potentially buffer that much in memory before sending 
> anything. Which works for your 17MB packfile, as we buffer 
> the whole thing and then send the exact size ahead of time, 
> appeasing the proxy.
> 
> But there are two problems I see with just bumping the 
> postBuffer value:
> 
>   1. You've just postponed the problem. The first 501MB push will fail
>      again. You can bump it higher, but you may eventually hit a point
>      where your buffer is too big to fit in RAM.
> 

Agreed. By then I hope to get our infrastructure team to address the proxies.
Liking the spool idea below. The other idea would be restrict the size of any
one transfer. (would that work if a given commit is large than the threshold???)

>   2. You've lost the pipelining. With a small postBuffer, we are
>      streaming content up to the server as pack-objects generates it.
>      But with a large buffer, we generate all of the content, 
> then start
>      sending the first byte (notice how the progress meter, which is
>      generated by pack-objects, shows twice as fast in the 
> second case.
>      It is not measuring the network at all, but is streaming into
>      git-remote-https's buffer).
> 
> If the server really insists on a content-length header, then 
> we can't ever fix (2). But we could fix (1) by spooling the 
> packfile to disk and then sending from there (under the 
> assumption that you have way more temporary disk space than RAM).
> 

Hmmm. So if the server says, hey I have a borked infrastructure, please send me
a content length git could spool then.

> However, if you have control of the proxies, the best thing 
> would be to tweak its config to stop complaining about a lack 
> of content-length header (at least in cases where you're 
> getting a "chunked"
> content-transfer-encoding). That would solve both issues (and 
> without clients having to change anything).
> 

One of the many is under my control, I will get that one addressed but the
others there is no hope.

-Jason


--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-                                                               -
- Jason Pyeron                      PD Inc. http://www.pdinc.us -
- Principal Consultant              10 West 24th Street #100    -
- +1 (443) 269-1555 x333            Baltimore, Maryland 21218   -
-                                                               -
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
This message is copyright PD Inc, subject to license 20080407P00.

 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: http.postBuffer set at the server side?
  2013-08-29  4:40   ` Jason Pyeron
@ 2013-08-29  6:31     ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2013-08-29  6:31 UTC (permalink / raw)
  To: Jason Pyeron; +Cc: git

On Thu, Aug 29, 2013 at 12:40:16AM -0400, Jason Pyeron wrote:

> > What would it mean to set it on the server?  It is the size 
> > at which the client decides to use a "chunked" 
> 
> To tell the client...

But the server in this case cannot tell it a useful size. Only "whatever
you do, do not chunk".

> Agreed. By then I hope to get our infrastructure team to address the proxies.
> Liking the spool idea below. The other idea would be restrict the size of any
> one transfer. (would that work if a given commit is large than the threshold???)

I don't think you can do that elegantly. The packfile needs to come up
as a whole, because the server is stateless. The best you could do is to
split the packfile up into small updates of history, and then have the
server receive each (and update the refs) incrementally. But even that
isn't foolproof; it could be that a single large blob object is larger
than the limit.

> > If the server really insists on a content-length header, then 
> > we can't ever fix (2). But we could fix (1) by spooling the 
> > packfile to disk and then sending from there (under the 
> > assumption that you have way more temporary disk space than RAM).
> 
> Hmmm. So if the server says, hey I have a borked infrastructure, please send me
> a content length git could spool then.

I'm not sure how the server would say that. It can return a 411, which
it is currently doing, but the git client will have already discarded
the data by that point. So it would have to come during one of the
earlier responses (I guess an extra http header? I surely would not want
to pollute the git protocol with such hackery).

So let's imagine that we figure that part out, and now we can ship a 1G
packfile up in a single POST by spooling it to disk. Do the proxies
actually allow that? Or do they also have a max-size-per-post setting?

If there is a maximum size, we can't get around that. And if it's small
enough, there's no point in spooling, as we can just get by with
tweaking http.postBuffer instead.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-29  6:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-28 23:08 http.postBuffer set at the server side? Pyeron, Jason J CTR (US)
2013-08-29  3:52 ` Jeff King
2013-08-29  4:40   ` Jason Pyeron
2013-08-29  6:31     ` Jeff King

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 NNTP newsgroup(s).