You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Artem Litvinovich <al...@columbia.edu> on 2001/11/12 11:53:38 UTC

xml parsing under mod_perl segfaults

Hello mod_perl gurus,

I am trying to do some xml parsing under mod_perl. My script basically looks 
like this:

#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);
use XML::Parser;
use XML::SimpleObject;

my $file="test.xml";
my $parser = XML::Parser->new(ErrorContext => 2, Style => "Tree");
my $xml = XML::SimpleObject->new($parser->parsefile($file)); # mod_perl killer

print header(); 
...

When executed at command line and under handler cgi-script the script works 
fine. However, when run under mod_perl the Apache child segfaults with:
[notice] child pid 16608 exit signal Segmentation fault (11)
The problem occurs at line marked as the mod_perl killer when parser tries to 
parse $file.

I have observed identical behavior under the following setups:
[freeBSD] Apache/1.3.12 mod_perl/1.21 Perl 5.005_03 built for i386-freebsd
[linux] Apache/1.3.19 mod_perl/1.24_01 Perl v5.6.0  built for i386-linux

Searching through various mailing lists revealed there maybe conflicts w/ 
Apache's expat, with a solution being to recompile without it. Postings with 
this same problem date back to almost one year ago. Since my freeBSD setup is 
a "virtual private server" from verio I cannot easily recompile+reinstall 
apache.

Please reply if you are aware of a fix for this problem or a workaround for 
parsing XML under mod_perl. (a fix that does not require apache recompilation 
would be ideal)

Thanks,
//Artem

Re: xml parsing under mod_perl segfaults

Posted by Philip Mak <pm...@aaanime.net>.
On Mon, 12 Nov 2001, Artem Litvinovich wrote:

> Since my freeBSD setup is a "virtual private server" from verio I
> cannot easily recompile+reinstall apache.

I have a virtual private server account from Verio too. What you could do,
is compile your own Apache and run it on a high port, then setup ProxyPass
or RewriteRule [P] so that the Apache on port 80 (that you can't
recompile) just proxies to the one on the high port.

That's probably better from a performance point of view too - if you serve
static content (e.g. JPG files) on your website, it costs less resources
to have a non-mod_perl frontend to serve the graphics for you. (If your
site doesn't get that much traffic it's not so important, of course.)