Submitter | Quan Thanh Nguyen |
---|---|
Date | March 14, 2013, 9:48 a.m. |
Message ID | <51419CE0.3070804@gcs-vn.com> |
Download | mbox | patch |
Permalink | /patch/1126/ |
State | Not Applicable, archived |
Headers | show |
Comments
On Thu, 2013-03-14 at 16:48 +0700, Quan Thanh Nguyen wrote: > Dear Mercurial development team > > I'm using Mercurial 2.2.2 with Python 2.5.1. I install Python and > Mercurial from Mercurial source release on Ubuntu 10.04. > My Mercurial server use apache2 with ssl protocol. When I use 'push' > command the error happening: > > File > "<mercurial_path>/lib/python2.5/site-packages/mercurial/keepalive.py", > line 259, in do_open > raise urllib2.URLError(err) > URLError: <urlopen error (8, 'EOF occurred in violation of protocol')> > abort: error: EOF occurred in violation of protocol > > ----------------------------------------------------------------------------------------------------------------------------------------- > I tried to debug and I get some information: > This error happen when attribute _start_transaction of class > KeepAliveHandler in keepalive.py file call 'h.send(data)' with empty data. > And I modified the source code of _start_transaction attribute: > > --- keepalive.py 2013-03-14 16:45:46.984593616 +0700 > +++ keepalive.py.modify 2013-03-14 16:45:33.520094059 +0700 > @@ -353,7 +353,8 @@ > h.putheader(k, v) > h.endheaders() > if req.has_data(): > - h.send(data) > + if len(data) > 0: > + h.send(data) I put some instrumentation here and it appears that we send a harmless zero-length data chunk on _most pushes_, which means this is very unlikely to be the problem. In other words, if there were a problem here, we would be hearing about it 5000 times a day for the past 7 years. These "EOF" errors almost always mean something is wrong with the server config.
Patch
--- keepalive.py 2013-03-14 16:45:46.984593616 +0700 +++ keepalive.py.modify 2013-03-14 16:45:33.520094059 +0700 @@ -353,7 +353,8 @@ h.putheader(k, v) h.endheaders() if req.has_data(): - h.send(data) + if len(data) > 0: + h.send(data) class HTTPHandler(KeepAliveHandler, urllib2.HTTPHandler):