[PATCH] test-commandserver: use python instead of hg as the executable

Idan Kamara idankk86 at gmail.com
Thu Jun 21 15:19:15 CDT 2012


On Thu, Jun 21, 2012 at 11:01 PM, Matt Mackall <mpm at selenic.com> wrote:
>
> On Thu, 2012-06-21 at 20:41 +0200, Adrian Buehlmann wrote:
> > On 2012-06-21 13:41, Adrian Buehlmann wrote:
> > > On 2012-06-21 09:37, Pierre-Yves David wrote:
> > >> On Thu, Jun 21, 2012 at 02:33:06AM +0200, Adrian Buehlmann wrote:
> > >>> On 2012-06-21 00:42, Adrian Buehlmann wrote:
> > >>>> On 2012-06-21 00:22, Matt Mackall wrote:
> > >>>> diff --git a/tests/test-commandserver.py
> > >>>> b/tests/test-commandserver.py
> > >>>> --- a/tests/test-commandserver.py
> > >>>> +++ b/tests/test-commandserver.py
> > >>>> @@ -5,7 +5,7 @@
> > >>>>      if path:
> > >>>>          cmdline += ['-R', path]
> > >>>>
> > >>>> -    server = subprocess.Popen(cmdline, stdin=subprocess.PIPE,
> > >>>> +    server = subprocess.Popen(cmdline, shell=True,
> > >>>> stdin=subprocess.PIPE,
> > >>>>                                stdout=subprocess.PIPE)
> > >>>>
> > >>>>      return server
> > >>>>
> > >>>> would be an acceptable change, then test-commandserver.py passes
> > >>>> here
> > >>>> with a file hg.cmd in C:\Users\adi\hgrepos\hg-main containing:
> > >>>
> > >>> On Ubuntu Linux, test-commandserver.py crashes here with that patch:
> > >>>
> > >>> +Traceback (most recent call last):
> > >>> +  File "/home/adi/hgrepos/hg-main/tests/test-commandserver.py",
> > >>> line 242, in <module>
> > >>> +    check(hellomessage)
> > >>> +  File "/home/adi/hgrepos/hg-main/tests/test-commandserver.py",
> > >>> line 63, in check
> > >>> +    return func(server)
> > >>> +  File "/home/adi/hgrepos/hg-main/tests/test-commandserver.py",
> > >>> line 72, in hellomessage
> > >>> +    ch, data = readchannel(server)
> > >>> +  File "/home/adi/hgrepos/hg-main/tests/test-commandserver.py",
> > >>> line 26, in readchannel
> > >>> +    return channel, server.stdout.read(length)
> > >>> +MemoryError
> > >>
> > >> They are tons of possible cause for a MemoryError, the most common
> > >> one being
> > >> "Firefox is eating your ram with a Ladle".
> > >>
> > >> I do not see why switching to shell=True should be the main suspect
> > >> for such
> > >> error. I just tried on linux (debian squeeze) and it works great.
> > >
> > > Ok. Thanks for testing.
> > >
> > > It can't be related to Firefox here, as I don't use that. This is a
> > > 32-bit Ubuntu in a VirtualBox VM here, which I only use for mercuial
> > > testing. The most demanding application I use there is probably
> > > TortoiseHg, but even if that's running, there is plenty of free RAM
> > > left
> > > (~85% free).
> > >
> > > This is a 32-bit Ubuntu 11.04 (natty), with Kernel Linux
> > > 2.6.38-15-generic, 1.4 GiB RAM, Python 2.7.1+ (r271:86832, Apr 11
> > > 2011,
> > > 18:05:24).
> > >
> > > The MemoryError consistently shows up with the patch applied, and not
> > > without the patch applied.
> > >
> > > This is the first time I have such problem with that VM.
> > >
> > > So I guess I'm tripping over some bug which might be unrelated to
> > > mercurial, but that usage triggers the bug. :(
> > >
> > > Perhaps I should ditch that VM and install a newer Ubuntu.
> >
> > So.. I have now switched into completely different Ubuntu install in a
> > different VM. This time, it's a 64-bit VM.
>
> That's very odd. I get weird behavior, but no MemoryError. I suspect
> what's happening is:
>
> - subprocess is doing something dumb with argument lists when shell mode
> is used
> - hg gets launched with no args
> - hg outputs some banner that gets interpreted as protocol
> - some ASCII characters get interpreted as "here comes a huge read"
> - test-commandserver tries to allocate a big buffer
> - MemoryError on small boxes

I've seen similar things happen (usually I'd get hangs), so this seems
likely.

>
>  This works here:
>
> $ hg diff
> diff -r 21e18c608b68 tests/test-commandserver.py
> --- a/tests/test-commandserver.py       Thu Jun 14 11:43:48 2012 +0200
> +++ b/tests/test-commandserver.py       Thu Jun 21 14:53:42 2012 -0500
> @@ -2,11 +2,12 @@
>
>  def connect(path=None):
>     cmdline = ['hg', 'serve', '--cmdserver', 'pipe']
> +    cmdline = ' '.join(cmdline)
>     if path:
>         cmdline += ['-R', path]
>
>     server = subprocess.Popen(cmdline, stdin=subprocess.PIPE,
> -                              stdout=subprocess.PIPE)
> +                              stdout=subprocess.PIPE, shell=True)
>
>     return server
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20120621/af26596f/attachment.html>


More information about the Mercurial-devel mailing list