[mod_python] The DOs and DONTs of mod_python: second problem maybecornered.

Philippe C. Martin pmartin at snakecard.com
Tue Oct 18 21:45:43 EDT 2005


Got it I think: you mean more than one library are on my disk ?

If so, that's the only I found in the LIB path: /usr/lib/libexpat.so.0.5.0.

So that would mean that apache and python use the same right ?

I'll do some google to see if it is an old one.

Regards,

Philippe





On Wednesday 19 October 2005 01:33 am, Graham Dumpleton wrote:
> Philippe C. Martin wrote ..
>
> > Hi,
> >
> > I'm not sure that's enough info:
> >
> > Just for my knowledge, why would that have an effect in apache and not
> > the
> > command line ?
>
> Imagine if each version of expat used a slightly different structure
> layout or structure size for something. An object created in the code of
> the shared library when accessed by C code compiled against the library,
> but that of a different version, could access the wrong bit of the
> object and thus follow a bogus pointer and thus crash.
>
> Consider this platform I have access to:
>
> cinderella$ python
> Python 2.3.4 (#1, Nov 25 2004, 17:05:37)
> [GCC 3.3.2] on sunos5
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import pyexpat
> >>> pyexpat.version_info
>
> (1, 95, 7)
>
> >>> ^D
>
> cinderella$ cd /usr/local/lib
> cinderella$ strings libexpat.so | grep expat_
> expat_1.95.4
>
> The libexpat.so installed on the system has an older version than that
> compiled into Python. If something causes the libexpat.so to be linked
> into Apache at the same time as the Python code executing from
> mod_python is using the embedded one, if there is an incompatability,
> there may be a problem.
>
> In this case, I should be looking at upgrading the one installed in the
> operating system.
>
> Depending on your system the libexpat.so might be in /lib, /usr/lib,
> /usr/local/lib or elsewhere.
>
> Graham
>
> > [philippe at pcmsc philippe]$ python
> > Python 2.4.2 (#1, Oct 18 2005, 04:32:14)
> > [GCC 3.4.1 (Mandrakelinux 10.1 3.4.1-4mdk)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> >
> > >>> import pyexpat
> > >>> pyexpat.version_info
> >
> > (1, 95, 8)
> >
> > >>> import expat
> >
> > Traceback (most recent call last):
> >   File "<stdin>", line 1, in ?
> > ImportError: No module named expat
> >
> >
> >
> > [philippe at pcmsc SC]$ find /usr/lib/python2.4/ -name '*expat*' -exec ls
> > -l {}
> > \;
> > -rw-r--r--  1 root root 2586 Oct 18
> > 04:35 /usr/lib/python2.4/test/output/test_pyexpat
> > -rw-r--r--  1 root root 12012 Oct 18
> > 04:35 /usr/lib/python2.4/test/test_pyexpat.py
> > -rw-r--r--  1 root root 11514 Oct 18
> > 04:36 /usr/lib/python2.4/test/test_pyexpat.pyc
> > -rw-r--r--  1 root root 11514 Oct 18
> > 04:36 /usr/lib/python2.4/test/test_pyexpat.pyo
> > -rw-r--r--  1 root root 36379 Oct 18
> > 04:35 /usr/lib/python2.4/xml/dom/expatbuilder.py
> > -rw-r--r--  1 root root 31084 Oct 18
> > 04:36 /usr/lib/python2.4/xml/dom/expatbuilder.pyc
> > -rw-r--r--  1 root root 30453 Oct 18
> > 04:36 /usr/lib/python2.4/xml/dom/expatbuilder.pyo
> > -rw-r--r--  1 root root 112 Oct 18
> > 04:35 /usr/lib/python2.4/xml/parsers/expat.py
> > -rw-r--r--  1 root root 273 Oct 18
> > 04:36 /usr/lib/python2.4/xml/parsers/expat.pyc
> > -rw-r--r--  1 root root 273 Oct 18
> > 04:36 /usr/lib/python2.4/xml/parsers/expat.pyo
> > -rw-r--r--  1 root root 14408 Oct 18
> > 04:35 /usr/lib/python2.4/xml/sax/expatreader.py
> > -rw-r--r--  1 root root 13471 Oct 18
> > 04:36 /usr/lib/python2.4/xml/sax/expatreader.pyc
> > -rw-r--r--  1 root root 13471 Oct 18
> > 04:36 /usr/lib/python2.4/xml/sax/expatreader.pyo
> > -rwxr-xr-x  1 root root 436290 Oct 18
> > 04:33 /usr/lib/python2.4/lib-dynload/pyexpat.so
> >
> > On Wednesday 19 October 2005 12:35 am, Graham Dumpleton wrote:
> > > Philippe C. Martin wrote ..
> > >
> > > > Hi,
> > > >
> > > > If any of you wish to look at this: this code works in command line,
> >
> > and
> >
> > > > crashes with apache. Something I'm doing is really anoying minidom.
> > > >
> > > >
> > > > you can fetch the xml file responsible at:
> > > > www.snakecard.com/mod_python
> > > >
> > > > Any help is greatly appreciated.
> > >
> > > I you are using a module which does XML processing and it is literally
> > > crashing, look at what version of the expat libraries that are
> > > installed on your system.
> > >
> > > A problem that can occur is that Python embeds a version of expat
> > > within its pyexpat module. If an incompatible version of expat is also
> > > linked in as a shared library, a crash generally occurs.
> > >
> > > To determine the version of expat embedded in Python, do from a command
> > >
> > > line run Python:
> > > >>> import pyexpat
> > > >>> pyexpat.version_info
> > >
> > > (1, 95, 6)
> > >
> > > Ensure that the version of any expat shared library is at least newer
> > > than that embedded into Python, or the same version if possible.
> > >
> > > Graham
> >
> > --
> > *************************************
> > Philippe C. Martin
> > SnakeCard, LLC
> > www.snakecard.com
> > +1 405 694 8098
> > *************************************

-- 
*************************************
Philippe C. Martin
SnakeCard, LLC
www.snakecard.com
+1 405 694 8098
*************************************


More information about the Mod_python mailing list