Increasing the Apache TimeOut to fix a failing push due to a gateway timeout

433 views
Skip to first unread message

Angel Ezquerra

unread,
Sep 4, 2012, 1:24:54 AM9/4/12
to Mercurial
Hi,

a colleague of mine had trouble pushing to one of the repositories in
our central mercurial web server. His push included a revision that
added a lot of files, some of them in the order of 100 MB. The total
size of the revision was around 500 MB.

When he tried to push the push failed after a while with a "gateway
timeout" message. When this happened the central repo would get
"broken" since there would be an interrupted transaction which must
had to be rolled back.

The server is a Windows 2003 x64 machine running Apache 2.2 with
mercurial configured as CGI. On the Apache error.log file I saw the
following error:

[Mon Sep 03 13:41:36 2012] [error] [client 192.168.40.67] Script
timed out before returning headers: hgweb.cgi

where 192.168.40.67 is my colleague's internal IP address.

So it seems that it takes a long time for mercurial to get finish the
push and the results on a timeout. Apparently Apache's default timeout
for any operation is 300 seconds and the push takes way longer than
that.

To fix the issue I have set the apache TimeOut to 1200 on the Apache
httpd.conf file. This seems to work but I am unsure whether this may
have some unintended consequences. Is this the right way to fix this?

Another thing that I find surprising is that the progress that is
shown by hg push increases until it got to 50.01% and then it stops.
Then it stays there for a quite long time until it times out. The same
happens after I change the apache TimeOut setting, except that now the
push finishes fine (but it never shows a progress above 50.01%). Is
that normal?

Cheers,

Angel
_______________________________________________
Mercurial mailing list
Merc...@selenic.com
http://selenic.com/mailman/listinfo/mercurial

Mads Kiilerich

unread,
Sep 4, 2012, 5:08:47 AM9/4/12
to Angel Ezquerra, Mercurial
On 09/04/2012 07:24 AM, Angel Ezquerra wrote:
> So it seems that it takes a long time for mercurial to get finish the
> push and the results on a timeout. Apparently Apache's default timeout
> for any operation is 300 seconds and the push takes way longer than
> that.
>
> To fix the issue I have set the apache TimeOut to 1200 on the Apache
> httpd.conf file. This seems to work but I am unsure whether this may
> have some unintended consequences. Is this the right way to fix this?

Yes, if the time spent seems reasonable considering the size of the data
and the available bandwidth then the only solution is to increase the
timeout.

> Another thing that I find surprising is that the progress that is
> shown by hg push increases until it got to 50.01% and then it stops.
> Then it stays there for a quite long time until it times out. The same
> happens after I change the apache TimeOut setting, except that now the
> push finishes fine (but it never shows a progress above 50.01%). Is
> that normal?

With HTTP POST and HTTP authentication it is hard to avoid having to
push all the data twice. That might explain why "something" changes at 50%.

/Mads

Angel Ezquerra

unread,
Sep 4, 2012, 5:18:03 AM9/4/12
to Mads Kiilerich, Mercurial
On Tue, Sep 4, 2012 at 11:08 AM, Mads Kiilerich <ma...@kiilerich.com> wrote:
> On 09/04/2012 07:24 AM, Angel Ezquerra wrote:
>>
>> So it seems that it takes a long time for mercurial to get finish the
>> push and the results on a timeout. Apparently Apache's default timeout
>> for any operation is 300 seconds and the push takes way longer than
>> that.
>>
>> To fix the issue I have set the apache TimeOut to 1200 on the Apache
>> httpd.conf file. This seems to work but I am unsure whether this may
>> have some unintended consequences. Is this the right way to fix this?
>
>
> Yes, if the time spent seems reasonable considering the size of the data and
> the available bandwidth then the only solution is to increase the timeout.
>
>
>> Another thing that I find surprising is that the progress that is
>> shown by hg push increases until it got to 50.01% and then it stops.
>> Then it stays there for a quite long time until it times out. The same
>> happens after I change the apache TimeOut setting, except that now the
>> push finishes fine (but it never shows a progress above 50.01%). Is
>> that normal?
>
>
> With HTTP POST and HTTP authentication it is hard to avoid having to push
> all the data twice. That might explain why "something" changes at 50%.
>
> /Mads

Thank you Mads,

It is a bit shocking that the data must be sent twice! For such big
pushes it makes a big difference.

Regardless, if the data must be sent twice (:-O!) shouldn't mercurial
either adjust the progress percentages accordingly, or at least
continue increasing the progress up to 100% while the data is uploaded
the second time?

The fact that it only gets up to 50.01% and never reaches 100%, even
when it does finish properly is confusing.

Cheers,

Angel
Reply all
Reply to author
Forward
0 new messages