Error undefinied with wsgi script

Gaunet Sylvain (ASTEK) Sylvain.Gaunet at cnes.fr
Tue Oct 30 08:55:09 UTC 2012


Apache was restarted, we have always the problem except now, we've got no log to show ... like everything's fine although I have always the error (see error.PNG).

We've got apache with SELinux activated on a Red Hat Enterprise Linux Server release 6.3 (Santiago).

Our /etc/mercurial/hgrc :
---------------------------------------------------------
[defaults]
tag = -l

[ui]
archivemeta = false

[extensions]
hgk=
hgext.graphlog =

 [hooks]
tag = /local/admin/outils/acces_ihm

[web]
style = gitweb
---------------------------------------------------------



The wsgi script :
---------------------------------------------------------
cat /var/www/cgi-bin/ZED.wsgi
#!/usr/bin/env python
#
from mercurial import demandimport; demandimport.enable()
from mercurial.hgweb.hgwebdir_mod import hgwebdir

application = hgwebdir('/etc/mercurial/ZED.config')
---------------------------------------------------------

The config script :
---------------------------------------------------------
[collections]
/var/www/bases/projet = /var/www/bases/projet/ZED
---------------------------------------------------------


And the error appears only when I rollback a revision :
mkdir -p /var/www/bases/projet/ZED/ZED
cd /var/www/bases/projet/ZED/ZED
hg init
mkdir toto
cd toto
touch a b
hg commit -A -m "test1"
hg tag test1
touch c d
hg commit -A -m "test2"
hg tag test2
# Go to http://xxx.xxx.xxx.xxx/cgi-bin/ZED.wsgi and http://xxx.xxx.xxx.xxx/cgi-bin/ZED.wsgi/ZED/ZED work fine
hg rollback
# Go to http://xxx.xxx.xxx.xxx/cgi-bin/ZED.wsgi is OK but http://xxx.xxx.xxx.xxx/cgi-bin/ZED.wsgi/ZED/ZED is in error


The hook tag sets good permissions for apache. That works fine since 4 years. We change the machine and activate SELinux and this is the mess.

The web interface works fine with SELinux if no rollback.



-----Message d'origine-----
De : Gaunet Sylvain (ASTEK) 
Envoyé : lundi 29 octobre 2012 07:40
À : 'Matt Mackall'
Cc : Mads Kiilerich; mercurial at selenic.com
Objet : RE: Error undefinied with wsgi script

Indeed, when I have the first error, after many tries, I installed Mercurial 2.3.2 to see if it was the same. I didn't restart apache thinking that's ok. I will ask for a restart and keep you in touch.

-----Message d'origine-----
De : Matt Mackall [mailto:mpm at selenic.com] 
Envoyé : vendredi 26 octobre 2012 18:28
À : Gaunet Sylvain (ASTEK)
Cc : Mads Kiilerich; mercurial at selenic.com
Objet : RE: Error undefinied with wsgi script

On Fri, 2012-10-26 at 10:29 +0000, Gaunet Sylvain (ASTEK) wrote:
> However, there is something wrong. You'll find the log when we disable SELinux.
> 
> 
> We've got this error :
> RuntimeError: maximum recursion depth exceeded while calling a Python object, referer: http://XXXXXXXXX/cgi-bin/ZED.wsgi
> 
> Any idea ?

Here's what that trace looks like after a bit of tidying:

     File "mercurial/hgweb/hgwebdir_mod.py", line 147, in __call__
1       return self.run_wsgi(req)
     File "mercurial/hgweb/hgwebdir_mod.py", line 205, in run_wsgi
2       return hgweb(repo).run_wsgi(req)
     File "mercurial/hgweb/hgweb_mod.py", line 202, in run_wsgi
3       req.respond(HTTP_OK, ctype)
     File "mercurial/hgweb/webcommands.py", line 530, in summary
4       branches=branches,
  ^  File "mercurial/localrepo.py", line 349, in __getitem__
5 |    class tagscache(object):
  |  File "mercurial/context.py", line 28, in __init__
6 |    self._node = self._repo.lookup(changeid)
  |  File "mercurial/localrepo.py", line 759, in lookup
7 v    lock.release()
 RuntimeError: maximum recursion depth exceeded while calling a Python object

This trace is extremely bogus:

a) Lines 4 and 5 are not the start of executable statements
b) On line 7, there is no lock.release in lookup()
c) On line 5, tagscache is not in __getitem__

So the line number/function names don't pair up sanely with the printed
line of source code. This can happen if you modify the source while the
compiled version is running.

The reported source lines are from 2.0.2. The function name/line numbers
on frames 5 and 7 come from 2.3, but the code on line 6 actually is in
2.0.2!

That means you're somehow running a recent localrepo.py with an old
context.py, which is unlikely to work well. Since you have 2.0.2 on
disk, but parts of 2.3 in memory, I suspect you downgraded without
restarting your web server.

-- 
Mathematics is the supreme nostalgia of our time.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: error.PNG
Type: image/png
Size: 13858 bytes
Desc: error.PNG
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20121030/7d1c95b6/attachment-0002.png>


More information about the Mercurial mailing list