[mod_python] mod_python with xmlrplib

David Fraser davidf at sjsoft.com
Wed Jan 26 23:47:09 EST 2005


Graham Dumpleton 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
>
>  
>
Since this is a common problem, I wonder if there may be a way to put 
checks into the Python modules that use expat to prevent this happening?

David


More information about the Mod_python mailing list