You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Matthew H. Gerlach" <mg...@lightsurf.com> on 2001/10/19 02:48:19 UTC

Problem using mod_perl-1.26 with perl 5.6.1 and XML::Parser

Hi gang,

I am fairly new to mod_perl, but I would like to share my recent
experience and hope someone might offer some insight into my troubles.

Last week I whipped together a simple perl module that used XML::Simple
( a wrapper for XML::Parser) to parse some POST'd content.  Once parsed
the resulting data was munched a bit and then POST'd to another web
server.  Like everything perl it was quick to implement and ran quick as
well.  My problems came along when I moved my module to another server.
All of sudden Apache would segfault in the Expat library code when my
module parsed the content.  I noticed that I had different versions of
XML::Parser on the different machines (2.29 vs. 2.30).  XML::Parser-2.29
was the one on the working instance so I downgraded the box that was
segfaulting.  When I down graded the segfaults went away but a nasty
little problem showed up latter in the module where the data being sent
in my module's post was getting corrupted.  I narrowed down the problem
to the call to running the XML parser being related to the data
corruption.

At this point I found this mail list and searched the archive.  There
were lots of references to the "Expat" problem where Apache itself uses
a copy of Expat and a XML::Parser would use a different version of the
Expat.  There was discussion about required configuration parameters to
mod perl, but more importantly there was a post mentioning that Apache
1.3.22 made the whole problem go away.  Feeling inspired by my new found
knowledge of the problem, I decided a clean install of the new apache
was in order.  To be safe, I reinstalled RedHat 7.1 without RedHat's
apache.  I uninstalled perl 5.6.0 that came with RH7.1 and installed
perl 5.6.1.  I followed the "simple" mod_perl install instructions that
builds apache with perl statically linked.  My resulting install didn't
segfault, but my nasty bug was still there.

At this point I went back and fully duplicated the working
implementation: Apache 1.3.19, mod_perl 1.26 perl-5.005_3 and
XML::Parser-2.29.  The originally working system was on RH 6.2, and this
configuration worked on my new machine using RH 7.1.  This configuration
was built with the following commands:

    tar zxf apache_1.3.19.tar.gz
    cd apache_1.3.19
    ./configure --prefix=/lsurf/apache --enable-shared=max
--enable-module=all
    make
    make install
    cd ..

    tar zxf  mod_perl-1.26.tar.gz
    cd  mod_perl-1.26
    perl Makefile.PL USE_APXS=1 APACHE_PREFIX=/lsurf/apache EVERYTHING=1

    make
    make install

Now that I had something reproducible, I continued.  I rebuilt using
Apache 1.3.22 just like above, and everything continued to work.  I
upgraded to XML::Parser-2.30, and things continued to work.  It was only
when I went from perl 5.005_3 to 5.6.1 did my module break.  As I said
above I tried a statically linked apache.  I also tried building Apache
1.3.22 as above with perl 5.6.1 and my code failed with both
XML::Parser-2.29 and XML::Parser-2.30.  Whatever way I tried using perl
5.6.1 I had my nasty problem.

When configuring Apache 1.3.22 I noticed it said it was using the
system's libexpat which was installed with RH.  XML::Parser-2.29 uses
its own copy of expat, but XML::Parser-2.30 uses the system libexpat.
As I said with perl 5.005_3 I was able to use either version of
XML::Parser.

In the end I have a working implementation using perl-5.005_3, but I'd
sure feel better using the "latest stable perl", and it should work as
far as I can tell.  If anyone has some suggestions I'd be willing to
give them a try.

Thanks for your patience if you read this long winded post.

Matthew