[mod_python] mod_python with xmlrplib

Marco Catunda catunda at pobox.com
Thu Jan 27 14:32:53 EST 2005


Greats!!
Thanks everybody.
I resolved the problem in my system.

My config was:

/usr/local/desenv/python/Python-2.4# rpm -qa | grep expat
expat-1.95.5-6
expat-devel-1.95.5-6

/usr/local/desenv/python/Python-2.4# tail Modules/expat/expat.h
*/
#define XML_MAJOR_VERSION 1
#define XML_MINOR_VERSION 95
#define XML_MICRO_VERSION 8

The expat module used in apache was 1.95.5 version
and in python was 1.95.8. I recompiled apache with
expat 1.95.8 and everything worked fine.

--
Marco Catunda




Craig Warren wrote:
> Yeah ,I didn't see this problem till we moved to Python2.4. With 
> Python2.3 the old expat libraries worked.
> 
> Craig
> 
> 
> Indrek Järve wrote:
> 
>> Didn't Python 2.4 include a newer version of the expat library?
>> *checks*
>> Indeed, the post is here: 
>> http://mail.python.org/pipermail/xml-sig/2004-August/010405.html
>> The library mismatch could be the problem, as described in the thread 
>> in the link:
>> http://mail.python.org/pipermail/python-list/2004-December/256676.html
>>
>> Regards,
>> Indrek
>>
>> Mark McClain wrote:
>>
>>> 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
>>>>
>>>
>>> _______________________________________________
>>> Mod_python mailing list
>>> Mod_python at modpython.org
>>> http://mailman.modpython.org/mailman/listinfo/mod_python
>>
>>
>>
>>
>> _______________________________________________
>> Mod_python mailing list
>> Mod_python at modpython.org
>> http://mailman.modpython.org/mailman/listinfo/mod_python
> 
> 
> 
> _______________________________________________
> 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