[mod_python] mod_python losing variables and functions

Nicolas Lehuen nicolas.lehuen at gmail.com
Fri Feb 18 01:59:53 EST 2005


On Thu, 17 Feb 2005 17:42:06 -0500, Jack Neely <jjneely at pams.ncsu.edu> wrote:
> Folks,
> 
> I've got a weird problem that I've been hanging my head against for some
> time now.  I have a small XMLRPC client/server system that I used to
> monitor several hundred Red Hat machines.  After a few days of running
> (several hundred hits every 4 hours) the following traceback starts to
> show up and the clients get a Internal Server Error.
> 
> [Thu Feb 17 16:28:20 2005] [error] [client 152.1.9.153] PythonHandler
> handler: Traceback (most recent call last):
> [Thu Feb 17 16:28:20 2005] [error] [client 152.1.9.153] PythonHandler
> handler:  File
> "/usr/src/build/513032-i386/install/usr/lib/python2.2/site-packages/mod_python/apache.py",
> line 332, in HandlerDispatch
> [Thu Feb 17 16:28:20 2005] [error] [client 152.1.9.153] PythonHandler
> handler:  File "handler.py", line 66, in handler!    method_ret =
> call_method(method, params, req)
> [Thu Feb 17 16:28:20 2005] [error] [client 152.1.9.153] PythonHandler
> handler:  File "handler.py", line 101, in call_method!    raise
> Exception(s)
> [Thu Feb 17 16:28:20 2005] [error] [client 152.1.9.153] PythonHandler
> handler: Exception: AttributeError!  dir(API) = ['__builtins__',
> '__doc__', '__file__', '__name__', 'req', 'socket']!Exception = 'module'
> object has no attribute '__API__'!
> 
> Basically, my code imports a module called API which defines __API__
> which is a list of strings.  Those strings represent the functions in
> the API module that are exposed via the XMLRPC interface.  It is
> completely losing __API__ and all my functions.
> 
> handler.py:
> http://anduril.pams.ncsu.edu/~slack/handler.py
> 
> API.py:
> http://anduril.pams.ncsu.edu/~slack/API.py

Your method for getting the __API__ attribute is a bit strange :

exports = eval("%s.__API__" % call)

Have you tried :

exports = getatttr(call,"__API__")

Does it raise the same exception ?

Regards,
Nicolas

> My google'ing has turned up an email or two that might be the same or
> similar problem but no solutions or ideas what to look for.
> 
> My servier running apache/mod_python is RHEL 3.  python-2.2.3-6.1
> mod_python-3.0.3-5.ent  httpd-2.0.46-44.ent
> 
> What really gets me is that I also maintain Current.
> http://current.tigris.org  This XMLRPC server is based off of the
> Current code which, to my knowledge has never hit this problem before.
> 
> Thanks!
> 
> Jack Neely
> 
> --
> Jack Neely <slack at quackmaster.net>
> Realm Linux Administration and Development
> PAMS Computer Operations at NC State University
> GPG Fingerprint: 1917 5AC1 E828 9337 7AA4  EA6B 213B 765F 3B6A 5B89
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list