[mod_python] SimpleXMLRPCServer causing seg fault?

Graham Dumpleton grahamd at dscpl.com.au
Fri May 13 00:00:43 EDT 2005


Michael wrote ..
> 
> >Most likely cause arises from fact that PyXML module in Python embeds
> its
> >own version of expat code. If something else you use with Apache, such
> as
> >PHP, links against a shared library version of expat library and the versions
> >are different, you will see a server crash when importing any Python module
> >which uses the XML module.
> >  
> >
> I only compile SSL and mod_python into Apache and use a custom compiled
> copy of Python with it. I also use sgmlop (I tried with and without 
> after compile..) but that doesn't seem to make any difference now. Any
> idea what else I should look at?

Compiled in or loaded as DSO?

In respect of PHP, it doesn't need to be compiled in, it merely needs to be
loaded as DSO using LoadModule directive. A PHP page doesn't even need
to have been loaded by a request.

Anyway, expat shared library versioning issues is the only cause I know of
for importing of XML type modules crashing Apache. Suggest that in a
separate handler you try importing "xmlrpclib" and see if you get the same
sort of crash.

BTW, ever looked at Vampire? It has a nice and simple mechanism for
creating XML-RPC services in mod_python.

  http://www.dscpl.com.au/projects/vampire/articles/vampire-001.html#implementing-web-services

Using Vampire's mechanism is better than SimpleXMLRPCServer as it
optionally allows you to access the original mod_python "req" object if
you need to:

  http://www.dscpl.com.au/projects/vampire/source/examples/xmlrpc/service.py

Also allows publishing of basic data types such that call will return their
value without you needing to wrap them with an actual function.

Graham


More information about the Mod_python mailing list