[mod_python] mod_python with xmlrplib

Mark McClain mark at gsoa.net
Thu Jan 27 10:29:10 EST 2005


This is probably has something do to with the library conflicts.  Our 
production servers (mod_python 3.1.x, apache 2.0.x, python 2.3.x) has 
been using xmlrpclib for over a year without any crashes.

Have you compiled your own versions of apache,mod_python, and python?  
Or are you using the stock redhat versions?

Mark

On Jan 26, 2005, at 11:47 PM, David Fraser wrote:

> 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
> _______________________________________________
> 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