Re: mod_perl segfaulting (Redhat 7.2, DSO, Apache 1.3.20)
I noticed you list XML::Simple. It is a favorite module of mine, but it uses XML::Parser which uses the expat XML parser. It is seems that mod_perl has problems with XML::Parser. This problem is supposed to be fixed in Apache 1.3.22, but I still had problems with strange segfaults and munched scalers when using XML::Parser. I recommend switching XML parsers to one that doesn't use expat. I had good luck using XML::LibXML, especially after making a Simple API :) Matthew Gerlach John Chia wrote: > Hi, > > I have a very annoying problem with mod_perl segfaulting. It must be > some perl code, but I cannot isolate where. Here are the symptoms, all > running on 7.2: > > 1) does not happen with apache/mod_perl compiled and linked on RedHat 6.2 > 2) does not happen with apache/mod_perl statically linked on Redhat 7.2 > 3) does happen with apache from 6.2 and mod_perl (re)linked on 7.2 > > I don't really want to go static, plus I'm a good guinea pig for this > sort of thing! Stack traces... > > ** gdb 'where' after segfaulting: > > #0 __pthread_mutex_lock (mutex=0x67617765) at mutex.c:99 > #1 0x401b0974 in __libc_free (mem=0x40515b18) at malloc.c:3152 > #2 0x404bdb08 in Perl_sv_clear () from /usr/lib/apache/libperl.so > #3 0x404bdd3f in Perl_sv_free () from /usr/lib/apache/libperl.so > #4 0x404b7bf4 in S_visit () from /usr/lib/apache/libperl.so > #5 0x404b7c87 in Perl_sv_clean_all () from /usr/lib/apache/libperl.so > #6 0x4046f08e in perl_destruct () from /usr/lib/apache/libperl.so > #7 0x4044ee2b in perl_shutdown () from /usr/lib/apache/libperl.so > #8 0x4044f2a5 in mp_dso_unload () from /usr/lib/apache/libperl.so > #9 0x080525f9 in ap_run_cleanup () at eval.c:41 > #10 0x080510cb in ap_clear_pool () at eval.c:41 > #11 0x08060220 in ap_child_terminate () at eval.c:41 > #12 0x08060c03 in main () at eval.c:41 > #13 0x40150306 in __libc_start_main (main=0x8060780 , argc=2, > ubp_av=0xbb54, init=0x804fb20 <_init>, fini=0x8089450 <_fini>, > rtld_fini=0x4000d2cc <_dl_fini>, stack_end=0xbb4c) > at ../sysdeps/generic/libc-start.c:129 > > ** strace is not at all helpful.. reads mime.types, opens access_log > and does some rt_sigprocmask stuff then SIGSEGV. > > ** Interactive debugger via Apache::DB .. (sorry bout the mess) > > DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:349): > 349:return unless defined &DBI::trace_msg; # return unless > bootstrap'd ok > DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:350): > 350:local ($!,$?); > DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:351): > 351:DBI->trace_msg("-- DBI::END\n", 2); > DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:353): > 353:$DBI::PERL_ENDING = $DBI::PERL_ENDING = 1; # avoid typo > warning > DBI::CODE(0x884e440)(/usr/lib/perl5/site_perl/5.6.1/i386-linux/DBI.pm:354): > 354:DBI->disconnect_all() if %DBI::installed_drh; > AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:449): > 449:my $self = shift; > AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:450): > 450:my ($variable, $attrib); > AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:454): > 454:($variable = $AUTOLOAD) =~ s/.*:://; > AppConfig::State::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig/State.pm:457): > 457:$variable eq 'DESTROY' && return; > AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:206): > 206:my $self = shift; > AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:207): > 207:my $method; > AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:211): > 211:($method = $AUTOLOAD) =~ s/.*:://; > AppConfig::AUTOLOAD(/usr/lib/perl5/site_perl/5.6.1/AppConfig.pm:214): > 214:$method eq 'DESTROY' && return; > Segmentation fault > > ** Semi-complete module list: > perl-HTML-Table-1.12a-3mtl > perl-Log-Agent-0.2.8-3mtl > perl-MLDBM-2.00-7mtl > perl-URI-1.17-5mtl > perl-Storable-1.0.13-3mtl > perl-Filesys-Statvfs_Df-0.67-4mtl > perl-Proc-ProcessTable-0.33-4mtl > perl-IO-Interface-0.97-6mtl > perl-DBD-Pg-1.01-5mtl > perl-libnet-1.0704-8mtl > perl-Apache-GTopLimit-0.01-3mtl > perl-Crypt-SSLeay-0.31-5mtl > perl-Net-IMAP-Simple-0.93-4mtl > perl-App-Config-1.09-5mtl > perl-FreezeThaw-0.41-6mtl > perl-GTop-0.10-4mtl > perl-POE-0.17-4mtl > perl-Authen-Smb-0.91-3mtl > perl-Convert-ASN1-0.07-1 > perl-IMAP-Admin-1.5.1-3mtl > perl-Net-SNMP-3.5-1 > perl-HTML-Mason-1.04-6mtl > perl-GDGraph-1.33-6mtl > perl-XML-Writer-0.4-0 > perl-Time-HiRes-01.20-7mtl > perl-Archive-Tar-0.22-6mtl > perl-XML-Parser-2.30-7 > perl-Adaptor-0.2-1 > perl-GD-1.33-9mtl > perl-Apache-DB-0.06-1mtl > perl-ldap-0.25-5mtl > perl-Params-Validate-0.07-4mtl > perl-GDTextUtil-0.80-6mtl > perl-HTML-Parser-3.25-5mtl > perl-Net-DNS-0.12-6mtl > perl-Net-Printer-0.20-1 > perl-MIME-Base64-2.12-7mt
Re: xml parsing under mod_perl segfaults
For the record, I was unsuccessful using Apache 1.3.22, configured to use the "system" expat library, with XML::Parser 2.30. In the end I switched to using XML::LibXML. Matthew H. Gerlach Matt Sergeant wrote: > > -Original Message- > > From: Artem Litvinovich [mailto:[EMAIL PROTECTED]] > > > > 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) > > 1) Use XML::LibXML > 2) Use XML::SAX::PurePerl (which is slower, but still works) > 3) Upgrade Apache to 1.3.22 and use XML::Parser 2.30 > > Unfortunately none of those yet support your SimpleObject, but I've sent a > patch/update of XML::Handler::Trees to Eric Bohlman, which will allow you to > use that. Email me if you want a copy that'll allow you to work with > XML::SAX::PurePerl. > > 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
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.
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