[Fwd: Re: traceback from hg serve]

Matt Mackall mpm at selenic.com
Thu May 1 21:20:53 UTC 2014


Rescued from my black hole that is my private inbox

-------- Forwarded Message --------
From: James Gregory <james.jrg at gmail.com>
To: Matt Mackall <mpm at selenic.com>
Subject: Re: traceback from hg serve
Date: Wed, 30 Apr 2014 08:27:40 +0100

I definitely patched the correct file, as the patch is still there - I
never deleted it after trying it. Also, the line numbers in some later
tracebacks only make sense if your patch line is there, which means I
definitely did restart the server.

You are correct about there actually being two exceptions, one for
each side of the trace. The the other exception looks something like
this:

  File "/usr/local/lib/python2.7/dist-packages/mercurial/hgweb/server.py",
line 80, in do_POST
    self.do_write()
  File "/usr/local/lib/python2.7/dist-packages/mercurial/hgweb/server.py",
line 73, in do_write
    self.do_hgweb()
  File "/usr/local/lib/python2.7/dist-packages/mercurial/hgweb/server.py",
line 140, in do_hgweb
    for chunk in self.server.application(env, self._start_response):
  File "/usr/local/lib/python2.7/dist-packages/mercurial/hgweb/hgwebdir_mod.py",
line 153, in __call__
    return self.run_wsgi(req)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/hgweb/hgwebdir_mod.py",
line 218, in run_wsgi
    return hgweb(repo).run_wsgi(req)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/hgweb/hgweb_mod.py",
line 68, in __init__
    r.baseui.setconfig('ui', 'report_untrusted', 'off')
  File "/usr/local/lib/python2.7/dist-packages/mercurial/ui.py", line
162, in setconfig
    self._tcfg.set(section, name, value)
  File "/usr/local/lib/python2.7/dist-packages/mercurial/config.py",
line 95, in set
    self._data[section][item] = value
  File "/usr/local/lib/python2.7/dist-packages/mercurial/config.py",
line 22, in __setitem__
    self._list.remove(key)
ValueError: list.remove(x): x not in list

Some fail on r.ui.setconfig..., whilst others fail on r.baseui.setconfig...
Is the r.ui object shared across threads? Maybe it too needs copying?


On 29 April 2014 22:38, Matt Mackall <mpm at selenic.com> wrote:
> On Mon, 2014-04-28 at 22:59 +0100, James Gregory wrote:
>> well 2.9.1 was already installed in /usr/local, so maybe even when
>> running the old hg in /usr/bin the lib dir was set such that it was
>> actually importing the files from 2.9.1 anyway.
>
> Could be.
>
>> As far as I am aware nothing is meant to be updating the config at
>> all,
>
> ..except for hgweb itself:
>
> http://www.selenic.com/hg/file/e9c2f76be74b/mercurial/hgweb/hgweb_mod.py#l67
>
> See those setconfigs? This is where I asked you to patch. The r.baseui
> object is shared across threads, so is thus problematic. Making a
> private copy should make the problem go away (provided you've edited the
> right copy of the library and fully restarted your webserver).
>
> Please also check your logs for different stack traces. If you see this
> frequently, you should also be able to see both sides of the race
> represented as different traces in your logs. One of them probably
> includes the code block above.
>
>> Does the GIL allow a thread context switch whenever a C library call
>> is made? If so then my previous statement about the GIL is nonsense,
>> as there are countless opportunities for context switching in just
>> about any code. I'm not a Python developer so I don't really know what
>> I'm talking about.
>
> The GIL allows switching on a Python bytecode granularity (and sometimes
> smaller). So yes, a switch can absolutely occur inside a for-loop.
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>



-- 
James

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list