You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Matt Williamson <ma...@sanasecurity.com> on 2007/09/04 22:12:44 UTC

seg faults when running modperl and GD::Graph

I noticed that my server is segfaulting when I run a script using
GD::Graph

e.g.

[Fri Aug 31 09:26:14 2007] [notice] child pid 6385 exit signal
Segmentation fault (11)
[Fri Aug 31 09:26:18 2007] [notice] child pid 6386 exit signal
Segmentation fault (11)
[Fri Aug 31 09:26:23 2007] [notice] child pid 6387 exit signal
Segmentation fault (11)
[Fri Aug 31 09:30:06 2007] [notice] child pid 6394 exit signal
Segmentation fault (11)
[Fri Aug 31 09:30:52 2007] [notice] child pid 6462 exit signal
Segmentation fault (11)
[Fri Aug 31 09:31:01 2007] [notice] child pid 6448 exit signal
Segmentation fault (11)
[Fri Aug 31 09:31:06 2007] [notice] child pid 6463 exit signal
Segmentation fault (11)

I am running an ex-cgi script under ModPerl::Registry

<Location /perl>
     SetHandler perl-script
     PerlResponseHandler ModPerl::Registry
     Options +ExecCGI
     PerlOptions +ParseHeaders
</Location>

I have read some other places on the web about seg faults, suggesting
that it might be conflicts with other modules, e.g. php. However, it
looks pretty clear that it is the GD::Graph that is doing it.

Has anyone else seen this? Does anyone know how to fix/debug this? I am
going to try running my cgi with the PerlRun to see if that makes a
difference, although I'd prefer to run in modperl if I can.

Thank you in advance for your help

Matt

Re: seg faults when running modperl and GD::Graph

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Matt Williamson wrote:
> So I got apache to run under gdb, but I still am somewhat non-the-wiser.
> It appears to happen the second time that the handler is used to process
> the request, so I guess one workaround would be to call my script as a
> plain cgi. 

FYI compiling with -g will often give more more intelligible results
from gdb.  This should include the way you build both perl and httpd,
and therefore mod_perl.

RE: seg faults when running modperl and GD::Graph

Posted by Matt Williamson <ma...@sanasecurity.com>.
So I got apache to run under gdb, but I still am somewhat non-the-wiser.
It appears to happen the second time that the handler is used to process
the request, so I guess one workaround would be to call my script as a
plain cgi. 

I'm not really how to interpret the gdb backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1214974272 (LWP 20348)]
0xb76a9628 in XS_Apache2__RequestRec_send_cgi_header () from
/usr/lib/perl5/auto/Apache2/Response/Response.so
(gdb) bt
#0  0xb76a9628 in XS_Apache2__RequestRec_send_cgi_header () from
/usr/lib/perl5/auto/Apache2/Response/Response.so
#1  0xb787a3b9 in Perl_pp_entersub () from /usr/lib/libperl.so.5.8
#2  0xb7872917 in Perl_runops_standard () from /usr/lib/libperl.so.5.8
#3  0xb7811ef0 in Perl_get_cv () from /usr/lib/libperl.so.5.8
#4  0xb7815cf1 in Perl_call_sv () from /usr/lib/libperl.so.5.8
#5  0xb7931b7f in modperl_callback () from
/usr/lib/apache2/modules/mod_perl.so
#6  0xb7932451 in modperl_callback_run_handlers () from
/usr/lib/apache2/modules/mod_perl.so
#7  0xb79326ff in modperl_callback_per_dir () from
/usr/lib/apache2/modules/mod_perl.so
#8  0xb792cf61 in modperl_response_finish () from
/usr/lib/apache2/modules/mod_perl.so
#9  0xb792d1e2 in modperl_response_handler_cgi () from
/usr/lib/apache2/modules/mod_perl.so
#10 0x08077e38 in ap_run_handler ()
#11 0x080781bc in ap_invoke_handler ()
#12 0x08069c7f in ap_process_request ()
#13 0x08064c52 in _start ()


> -----Original Message-----
> From: William A. Rowe, Jr. [mailto:wrowe@rowe-clan.net]
> Sent: Wednesday, September 05, 2007 12:00 AM
> To: Manoj Bist
> Cc: Matt Williamson; rcaceres@aasa.com.pe; modperl@perl.apache.org
> Subject: Re: seg faults when running modperl and GD::Graph
> 
> Manoj Bist wrote:
> > One option would to be run apache under single threaded mode(option
> > -X) under gdb  and see where it is crashing.  Once you identify the
> > .so where it is crashing, you can try reproducing the crash outside
> > apache context.
> 
> See also http://httpd.apache.org/dev/debugging.html

Re: seg faults when running modperl and GD::Graph

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
Manoj Bist wrote:
> One option would to be run apache under single threaded mode(option
> -X) under gdb  and see where it is crashing.  Once you identify the
> .so where it is crashing, you can try reproducing the crash outside
> apache context.

See also http://httpd.apache.org/dev/debugging.html

Re: seg faults when running modperl and GD::Graph

Posted by Manoj Bist <ma...@gmail.com>.
One option would to be run apache under single threaded mode(option
-X) under gdb  and see where it is crashing.  Once you identify the
.so where it is crashing, you can try reproducing the crash outside
apache context.

If you suspect it to be a memory corruption issue you can try running
apache under valgrind.

On 9/4/07, Matt Williamson <ma...@sanasecurity.com> wrote:
> I don't think it can be php.
>
> I disabled php on the server, and I still get the seg faults
>
> [Tue Sep 04 21:45:19 2007] [notice] Apache/2.0.55 (Ubuntu)
> mod_perl/2.0.2 Perl/v5.8.7 configured -- resuming normal operations
>
>
> [Tue Sep 04 21:45:29 2007] [notice] child pid 18466 exit signal
> Segmentation fault (11)
> [Tue Sep 04 21:45:30 2007] [notice] child pid 18467 exit signal
> Segmentation fault (11)
> [Tue Sep 04 21:45:32 2007] [notice] child pid 18468 exit signal
> Segmentation fault (11)
>
> Any other ideas?
>
> Matt
>
>
>
> > -----Original Message-----
> > From: Rafael Caceres [mailto:rcaceres@aasa.com.pe]
> > Sent: Tuesday, September 04, 2007 1:38 PM
> > To: Matt Williamson
> > Cc: modperl@perl.apache.org
> > Subject: Re: seg faults when running modperl and GD::Graph
> >
> > If you have PHP (with mod_php) enabled on that server, that's the
> > culprit and it can be fixed by compiling PHP without GD support.
> >
> > On Tue, 2007-09-04 at 13:12 -0700, Matt Williamson wrote:
> > > I noticed that my server is segfaulting when I run a script using
> > > GD::Graph
>
>

RE: seg faults when running modperl and GD::Graph

Posted by Matt Williamson <ma...@sanasecurity.com>.
I don't think it can be php.

I disabled php on the server, and I still get the seg faults

[Tue Sep 04 21:45:19 2007] [notice] Apache/2.0.55 (Ubuntu)
mod_perl/2.0.2 Perl/v5.8.7 configured -- resuming normal operations


[Tue Sep 04 21:45:29 2007] [notice] child pid 18466 exit signal
Segmentation fault (11)
[Tue Sep 04 21:45:30 2007] [notice] child pid 18467 exit signal
Segmentation fault (11)
[Tue Sep 04 21:45:32 2007] [notice] child pid 18468 exit signal
Segmentation fault (11)

Any other ideas?

Matt



> -----Original Message-----
> From: Rafael Caceres [mailto:rcaceres@aasa.com.pe]
> Sent: Tuesday, September 04, 2007 1:38 PM
> To: Matt Williamson
> Cc: modperl@perl.apache.org
> Subject: Re: seg faults when running modperl and GD::Graph
> 
> If you have PHP (with mod_php) enabled on that server, that's the
> culprit and it can be fixed by compiling PHP without GD support.
> 
> On Tue, 2007-09-04 at 13:12 -0700, Matt Williamson wrote:
> > I noticed that my server is segfaulting when I run a script using
> > GD::Graph


RE: seg faults when running modperl and GD::Graph

Posted by Rafael Caceres <rc...@aasa.com.pe>.
Matt,
I had the problem with PHP4, but you can do a quick test commenting the
LoadModule php5_module line on your httpd.conf file and testing before
going full course. If that prevents the crash, then my guess is you'll
have to build PHP5 yourself.

Rafael
On Tue, 2007-09-04 at 14:06 -0700, Matt Williamson wrote:
> Ok, thanks.
> 
> I am not so familiar with php. I have 
> 
> LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
> 
> And
> <IfModule mod_php5.c>
>   AddType application/x-httpd-php .php .phtml .php3
>   AddType application/x-httpd-php-source .phps
> </IfModule>
> 
> So I guess I have mod_php5.
> 
> Do I have to recompile, or do you think I might find a php without GD as
> a pre-compiled ubuntu package?
> 
> I actually don't think I need php on this system, would removing it have
> the same effect?
> 
> Matt
> 
> > -----Original Message-----
> > From: Rafael Caceres [mailto:rcaceres@aasa.com.pe]
> > Sent: Tuesday, September 04, 2007 1:38 PM
> > To: Matt Williamson
> > Cc: modperl@perl.apache.org
> > Subject: Re: seg faults when running modperl and GD::Graph
> > 
> > If you have PHP (with mod_php) enabled on that server, that's the
> > culprit and it can be fixed by compiling PHP without GD support.
> > 
> > On Tue, 2007-09-04 at 13:12 -0700, Matt Williamson wrote:
> > > I noticed that my server is segfaulting when I run a script using
> > > GD::Graph
> > >
> > > e.g.
> > >
> > > [Fri Aug 31 09:26:14 2007] [notice] child pid 6385 exit signal
> > > Segmentation fault (11)
> > > [Fri Aug 31 09:26:18 2007] [notice] child pid 6386 exit signal
> > > Segmentation fault (11)
> > > [Fri Aug 31 09:26:23 2007] [notice] child pid 6387 exit signal
> > > Segmentation fault (11)
> > > [Fri Aug 31 09:30:06 2007] [notice] child pid 6394 exit signal
> > > Segmentation fault (11)
> > > [Fri Aug 31 09:30:52 2007] [notice] child pid 6462 exit signal
> > > Segmentation fault (11)
> > > [Fri Aug 31 09:31:01 2007] [notice] child pid 6448 exit signal
> > > Segmentation fault (11)
> > > [Fri Aug 31 09:31:06 2007] [notice] child pid 6463 exit signal
> > > Segmentation fault (11)
> > >
> > > I am running an ex-cgi script under ModPerl::Registry
> > >
> > > <Location /perl>
> > >      SetHandler perl-script
> > >      PerlResponseHandler ModPerl::Registry
> > >      Options +ExecCGI
> > >      PerlOptions +ParseHeaders
> > > </Location>
> > >
> > > I have read some other places on the web about seg faults,
> suggesting
> > > that it might be conflicts with other modules, e.g. php. However, it
> > > looks pretty clear that it is the GD::Graph that is doing it.
> > >
> > > Has anyone else seen this? Does anyone know how to fix/debug this? I
> am
> > > going to try running my cgi with the PerlRun to see if that makes a
> > > difference, although I'd prefer to run in modperl if I can.
> > >
> > > Thank you in advance for your help
> > >
> > > Matt
> > >
> > >
> > > 
> > >
> > >
> > >
> > > ________ Information from NOD32 ________
> > > This message was checked by NOD32 Antivirus System for Linux Mail
> > Servers.
> > >   part000.txt - is OK
> > > http://www.eset.com
> > >
> 
> 
> 
> !DSPAM:46ddc895252708074279129!
> 
> 
> 
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Servers.
>   part000.txt - is OK
> http://www.eset.com
> 


RE: seg faults when running modperl and GD::Graph

Posted by Matt Williamson <ma...@sanasecurity.com>.
Ok, thanks.

I am not so familiar with php. I have 

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

And
<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
</IfModule>

So I guess I have mod_php5.

Do I have to recompile, or do you think I might find a php without GD as
a pre-compiled ubuntu package?

I actually don't think I need php on this system, would removing it have
the same effect?

Matt

> -----Original Message-----
> From: Rafael Caceres [mailto:rcaceres@aasa.com.pe]
> Sent: Tuesday, September 04, 2007 1:38 PM
> To: Matt Williamson
> Cc: modperl@perl.apache.org
> Subject: Re: seg faults when running modperl and GD::Graph
> 
> If you have PHP (with mod_php) enabled on that server, that's the
> culprit and it can be fixed by compiling PHP without GD support.
> 
> On Tue, 2007-09-04 at 13:12 -0700, Matt Williamson wrote:
> > I noticed that my server is segfaulting when I run a script using
> > GD::Graph
> >
> > e.g.
> >
> > [Fri Aug 31 09:26:14 2007] [notice] child pid 6385 exit signal
> > Segmentation fault (11)
> > [Fri Aug 31 09:26:18 2007] [notice] child pid 6386 exit signal
> > Segmentation fault (11)
> > [Fri Aug 31 09:26:23 2007] [notice] child pid 6387 exit signal
> > Segmentation fault (11)
> > [Fri Aug 31 09:30:06 2007] [notice] child pid 6394 exit signal
> > Segmentation fault (11)
> > [Fri Aug 31 09:30:52 2007] [notice] child pid 6462 exit signal
> > Segmentation fault (11)
> > [Fri Aug 31 09:31:01 2007] [notice] child pid 6448 exit signal
> > Segmentation fault (11)
> > [Fri Aug 31 09:31:06 2007] [notice] child pid 6463 exit signal
> > Segmentation fault (11)
> >
> > I am running an ex-cgi script under ModPerl::Registry
> >
> > <Location /perl>
> >      SetHandler perl-script
> >      PerlResponseHandler ModPerl::Registry
> >      Options +ExecCGI
> >      PerlOptions +ParseHeaders
> > </Location>
> >
> > I have read some other places on the web about seg faults,
suggesting
> > that it might be conflicts with other modules, e.g. php. However, it
> > looks pretty clear that it is the GD::Graph that is doing it.
> >
> > Has anyone else seen this? Does anyone know how to fix/debug this? I
am
> > going to try running my cgi with the PerlRun to see if that makes a
> > difference, although I'd prefer to run in modperl if I can.
> >
> > Thank you in advance for your help
> >
> > Matt
> >
> >
> > !DSPAM:46ddbc27171191804284693!
> >
> >
> >
> > ________ Information from NOD32 ________
> > This message was checked by NOD32 Antivirus System for Linux Mail
> Servers.
> >   part000.txt - is OK
> > http://www.eset.com
> >


Re: seg faults when running modperl and GD::Graph

Posted by Rafael Caceres <rc...@aasa.com.pe>.
If you have PHP (with mod_php) enabled on that server, that's the
culprit and it can be fixed by compiling PHP without GD support.

On Tue, 2007-09-04 at 13:12 -0700, Matt Williamson wrote:
> I noticed that my server is segfaulting when I run a script using
> GD::Graph
> 
> e.g.
> 
> [Fri Aug 31 09:26:14 2007] [notice] child pid 6385 exit signal
> Segmentation fault (11)
> [Fri Aug 31 09:26:18 2007] [notice] child pid 6386 exit signal
> Segmentation fault (11)
> [Fri Aug 31 09:26:23 2007] [notice] child pid 6387 exit signal
> Segmentation fault (11)
> [Fri Aug 31 09:30:06 2007] [notice] child pid 6394 exit signal
> Segmentation fault (11)
> [Fri Aug 31 09:30:52 2007] [notice] child pid 6462 exit signal
> Segmentation fault (11)
> [Fri Aug 31 09:31:01 2007] [notice] child pid 6448 exit signal
> Segmentation fault (11)
> [Fri Aug 31 09:31:06 2007] [notice] child pid 6463 exit signal
> Segmentation fault (11)
> 
> I am running an ex-cgi script under ModPerl::Registry
> 
> <Location /perl>
>      SetHandler perl-script
>      PerlResponseHandler ModPerl::Registry
>      Options +ExecCGI
>      PerlOptions +ParseHeaders
> </Location>
> 
> I have read some other places on the web about seg faults, suggesting
> that it might be conflicts with other modules, e.g. php. However, it
> looks pretty clear that it is the GD::Graph that is doing it.
> 
> Has anyone else seen this? Does anyone know how to fix/debug this? I am
> going to try running my cgi with the PerlRun to see if that makes a
> difference, although I'd prefer to run in modperl if I can.
> 
> Thank you in advance for your help
> 
> Matt
> 
> 
> !DSPAM:46ddbc27171191804284693!
> 
> 
> 
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Servers.
>   part000.txt - is OK
> http://www.eset.com
> 


Re: Error running mod_perl on Apache within FreeBSD jail

Posted by Fred Moyer <fr...@redhotpenguin.com>.
Briggs, Chris wrote:
> I am running Apache 1.3 in a FreeBSD jail which works as expected. 
> 
> Next I added in mod_perl 1.0 by installing, adding the entry to the
> httpd.conf file to load dynamically and copy across the libraries to the
> jail. 
> 
> I also copied the usr/bin/perl file and the directories under perl5 to
> the jail, however apache will no longer start as it is displaying an
> error as follows: 

the Perl binary isn't relocatable (at least up to 5.10) so I don't think 
that you can just copy the binary, and the libraries and it will just 
work.  I'm not too familiar with how bsd jails work, but you might want 
to try downloading perl and compiling from source within the jail, and 
doing the same for mod_perl and Apache.

Does free bsd have a decent virtual machine that you could use instead 
of a jail?  Then you would be able to avoid this problem.  Chroot jails 
are old and busted, virtualization is the new hotness, at least that's 
what I've heard.

- Fred

Error running mod_perl on Apache within FreeBSD jail

Posted by "Briggs, Chris" <Ch...@uk.fid-intl.com>.
I am running Apache 1.3 in a FreeBSD jail which works as expected. 

Next I added in mod_perl 1.0 by installing, adding the entry to the
httpd.conf file to load dynamically and copy across the libraries to the
jail. 

I also copied the usr/bin/perl file and the directories under perl5 to
the jail, however apache will no longer start as it is displaying an
error as follows: 

Can't open perl script "/dev/null": Operation not supported 

I have tried removing and recreating the /dev/null device in the jail,
(as it was already there and working for the standard Apache install)
but to no avail. Any ideas as to what to try next - is anyone else using
Apache/Perl in a FreeBSD jail, I want to make the server secure as it
will be storing confidential data, however, perhaps there is a better
way.

Thank you in advance for any help

Chris




Important: Fidelity Investments International (Reg. No.1448245),
Fidelity Investment Services Limited (Reg. No. 2016555), Fidelity
Pensions Management (Reg. No. 2015142) and Financial Administration
Services Limited (Reg. No. 1629709, a Fidelity Group company) are all
registered in England and Wales, are authorised and regulated in the UK
by the Financial Services Authority and have their registered offices at
Oakhill House, 130 Tonbridge Road, Hildenborough, Tonbridge, Kent TN11
9DZ. Tel 01732 361144. Fidelity only gives information on products and
does not give investment advice to private clients based on individual
circumstances. Any comments or statements made are not necessarily those
of Fidelity. The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential and/or
privileged material. If you received this in error, please contact the
sender and delete the material from any computer. All e-mails sent from
or to Fidelity may be subject to our monitoring procedures. Direct link
to Fidelity's website -
http://www.fidelity-international.com/world/index.html