[mod_python] mod_python with xmlrplib

Chris Jackson christopher.jackson at gmail.com
Wed Jan 26 18:56:41 EST 2005


It should also be noted that this works fine in the python
interpreter, but crashes only during runtime when running in the
context of mod_python.

~= Chris =~


On Wed, 26 Jan 2005 18:55:35 -0500, Chris Jackson
<christopher.jackson at gmail.com> wrote:
> On a simliar note, I was just about to post an XML problem I had using
> regular Python XML (minidom).
> 
> <myconfig>
> mod_python version = 3.1.3
> Apache version = 2.0.52
> python version = 2.4
> </myconfig>
> 
> ...
> from xml.dom import minidom
> xmldoc = minidom.parse(myFile.xml)
> ...
> 
> After analyzing the logs files, I find segmentation faults occurring causing
> the page to hand and never get displayed. I have tested this on two
> separate systems and the results are the same.
> 
> I will try the methods described above and see what happens.
> 
> ~= Chris =~
> 
> 
> On Wed, 26 Jan 2005 18:36:40 -0500, Graham Dumpleton
> <grahamd at dscpl.com.au> wrote:
> > Marco Catunda wrote ..
> > > I haven't been able to use xmlrpclib with mod_python.
> > > When I import xmlrpclib the apache server crash (segmentation fault),
> > > the following code will be show it.
> > >
> > > =====================================
> > > from mod_python import apache
> > > import xmlrpclib
> > >
> > > def handler( req ):
> > >          req.write("Hello World!")
> > >          return apache.OK
> > > =====================================
> > >
> > > My system:
> > >    RedHat ES 3
> > >    Apache 2.0.52
> > >    Python 2.4
> > >
> > > Is there a way to fix it?
> >
> > The xmlrpclib module uses a Python XML module which looks like it tries
> > to use expat.
> >
> > >>> import xmlrpclib
> > >>> import sys
> > >>> sys.modules.keys()
> > ['cStringIO', 'copy_reg', 'sre_compile', '_sre', 'site', '__builtin__', 'xml.parsers.expat', 'xml._xmlplus', 'xml.parsers', 'xml.sys', '__main__', 'operator', 'xml.parsers.pyexpat', 'xml', 'posixpath', 'base64', 'binascii', 'pyexpat.errors', 'sre_constants', 're', 'os.path', 'stat', 'zipimport', 'string', 'warnings', 'UserDict', '_xmlplus', 'sys', 'readline', 'types', 'strop', 'sre', 'signal', 'xmlrpclib', 'linecache', 'posix', 'pyexpat.model', 'time', 'exceptions', 'sre_parse', 'os']
> >
> > It is a frequent problem that the version of the expat shared library which
> > is used by the Python modules differs to that which Apache or PHP may
> > already be using. This difference can result in a server crash.
> >
> > You should thus try to determine if you have multiple versions of expat
> > present and whether these different packages are using different versions.
> >
> > On Linux, you might be able to use "ldd" to work this out by running it
> > on the "httpd" binary, as well as the appropriate .so Python module.
> >
> >   ldd /somepath-to-apache-bin-dir/httpd
> >   ldd /somepath-to-python-module-dir/lib-dynload/pyexpat.so
> >   ldd /somepath-to-apache-module-dir/*php*.so
> >
> > The paths will need to be adjusted obviously.
> >
> > Please post the results of ldd if you can as am curious to see if this
> > does help, I have never suggested trying it before.
> >
> > Graham
> > _______________________________________________
> > 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