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

2001-10-18 Thread Matthew H. Gerlach


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




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

2001-10-19 Thread Matt Sergeant

> -Original Message-
> From: Matthew H. Gerlach [mailto:[EMAIL PROTECTED]]
> 
> 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.

>From what I can tell from the Apache 1.3.22 build, here's how to get it
stable:

1. Install libexpat.
2. Install perl
3. Install XML::Parser 2.30
4. Install mod_perl and Apache, telling mod_perl to build Apache for you.
  ** Do not use APXS to build mod_perl **

The recipe in the AxKit INSTALL file seems to work best for people doing XML
stuff inside mod_perl:

 $ perl Makefile.PL \
 > EVERYTHING=1 \
 > USE_APACI=1 \
 > DYNAMIC=1 \
 > APACHE_PREFIX=/opt/apache \
 > APACHE_SRC=../apache_1.3.22/src \
 > DO_HTTPD=1 \
 > APACI_ARGS="--enable-module=so --enable-shared=info
 > --enable-shared=proxy --enable-shared=rewrite
 > --enable-shared=log_agent"
 $ make
 $ su
 $ make install

However, that also builds Apache with --disable-rule=expat, so it might
kinda defeat your purpose :-) If you *really* need the expat in Apache, I
think you can add in there --enable-rule=expat, but I haven't tried it.

If all that fails, switch to XML::LibXML or XML::SAX::PurePerl (actually,
think about doing that anyway :-)

Matt.

_
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.



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

2001-10-19 Thread Matthew H. Gerlach


Just to follow up.  I took your advice on building building modperl.  My actual
command was as follows:


perl Makefile.PL \
EVERYTHING=1 \
USE_APACI=1 \
APACHE_PREFIX=/lsurf/wohg \
APACHE_SRC=../$APACHE/src \
DO_HTTP=1 \
APACI_ARGS="--enable-rule=expat --enable-module=so --enable-shared=info \
--enable-shared=proxy --enable-shared=rewrite"



I first tried this with perl 5.005_3 with no problems.  I then upgraded to perl
5.6.1, reinstalled the XML::Parser 2.30, and rebuild modperl/apache.  The nasty
bug showed back up.  At this point it still looks like I'm SOL using
XML::Parser with perl 5.6.1 under modper.

I did  download and install XML::LibXML and started playing with it.  I'm
actually using XML::Parser via XML::Simple to put short XML "messages" into
handy 'data structures'.   Maybe I should make an XML::LibXML::Simple :)

Thanks for the help,

Matthew



Matt Sergeant wrote:

> > -Original Message-
> > From: Matthew H. Gerlach [mailto:[EMAIL PROTECTED]]
> >
> > 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.
>
> >From what I can tell from the Apache 1.3.22 build, here's how to get it
> stable:
>
> 1. Install libexpat.
> 2. Install perl
> 3. Install XML::Parser 2.30
> 4. Install mod_perl and Apache, telling mod_perl to build Apache for you.
>   ** Do not use APXS to build mod_perl **
>
> The recipe in the AxKit INSTALL file seems to work best for people doing XML
> stuff inside mod_perl:
>
>  $ perl Makefile.PL \
>  > EVERYTHING=1 \
>  > USE_APACI=1 \
>  > DYNAMIC=1 \
>  > APACHE_PREFIX=/opt/apache \
>  > APACHE_SRC=../apache_1.3.22/src \
>  > DO_HTTPD=1 \
>  > APACI_ARGS="--enable-module=so --enable-shared=info
>  > --enable-shared=proxy --enable-shared=rewrite
>  > --enable-shared=log_agent"
>  $ make
>  $ su
>  $ make install
>
> However, that also builds Apache with --disable-rule=expat, so it might
> kinda defeat your purpose :-) If you *really* need the expat in Apache, I
> think you can add in there --enable-rule=expat, but I haven't tried it.
>
> If all that fails, switch to XML::LibXML or XML::SAX::PurePerl (actually,
> think about doing that anyway :-)
>
> Matt.
>
> _
> This message has been checked for all known viruses by Star Internet
> delivered through the MessageLabs Virus Scanning Service. For further
> information visit http://www.star.net.uk/stats.asp or alternatively call
> Star Internet for details on the Virus Scanning Service.




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

2001-10-19 Thread clayton cottingham

"Matthew H. Gerlach" wrote:
> 
> Just to follow up.  I took your advice on building building modperl.  My actual
> command was as follows:
> 
> perl Makefile.PL \
> EVERYTHING=1 \
> USE_APACI=1 \
> APACHE_PREFIX=/lsurf/wohg \
> APACHE_SRC=../$APACHE/src \
> DO_HTTP=1 \
> APACI_ARGS="--enable-rule=expat --enable-module=so --enable-shared=info \
> --enable-shared=proxy --enable-shared=rewrite"
> 
> I first tried this with perl 5.005_3 with no problems.  I then upgraded to perl
> 5.6.1, reinstalled the XML::Parser 2.30, and rebuild modperl/apache.  The nasty
> bug showed back up.  At this point it still looks like I'm SOL using
> XML::Parser with perl 5.6.1 under modper.
> 
> I did  download and install XML::LibXML and started playing with it.  I'm
> actually using XML::Parser via XML::Simple to put short XML "messages" into
> handy 'data structures'.   Maybe I should make an XML::LibXML::Simple :)
> 


i would say that XML::LibXML is the most stable
modules ive used
everything else perl has failed for the X3D parsing tool i made:
http://drfrog.fdns.net/perl/parsex3d.pl

this will have a much nicer home at web3d.org at some point soon
they found a bug in it on freebsd timezone related iirc