You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tyler Bird <bi...@epromo.com> on 2007/05/25 01:34:12 UTC

backtrace for segfault....

hey guys I read a little more and was able to generate a backtrace for 
my apache children segfaulting here it is below.

Program terminated with signal 11, Segmentation fault.
#0  0x0051389a in apr_palloc () from /usr/lib/libapr-1.so.0
(gdb) bt
#0  0x0051389a in apr_palloc () from /usr/lib/libapr-1.so.0
#1  0x0050bfed in apr_table_make () from /usr/lib/libapr-1.so.0
#2  0x00b8d9bc in ap_scan_script_header_err_core () from /usr/sbin/httpd
#3  0x00b8e006 in ap_scan_script_header_err_strs () from /usr/sbin/httpd
#4  0x006a60a0 in modperl_cgi_header_parse () from 
/etc/httpd/modules/mod_perl.so
#5  0x00906544 in XS_Apache2__RequestRec_send_cgi_header ()
   from 
/usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/Apache2/Response/Response.so
#6  0x0435c43d in Perl_pp_entersub () from 
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#7  0x0435589f in Perl_runops_standard ()
   from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#8  0x042f5fee in Perl_magicname () from 
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#9  0x042fa7e6 in Perl_call_sv () from 
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
#10 0x0069a77f in modperl_callback () from /etc/httpd/modules/mod_perl.so
#11 0x0069ae7a in modperl_callback_run_handlers () from 
/etc/httpd/modules/mod_perl.so
#12 0x0069b4ea in modperl_callback_per_dir () from 
/etc/httpd/modules/mod_perl.so
#13 0x0069464f in modperl_response_init () from 
/etc/httpd/modules/mod_perl.so
#14 0x0069481b in modperl_response_handler_cgi () from 
/etc/httpd/modules/mod_perl.so
#15 0x00b8785d in ap_run_handler () from /usr/sbin/httpd
#16 0x00b8b208 in ap_invoke_handler () from /usr/sbin/httpd
#17 0x00b971ce in ap_process_request () from /usr/sbin/httpd
#18 0x00b93fbf in ap_register_input_filter () from /usr/sbin/httpd
#19 0x00b8f71d in ap_run_process_connection () from /usr/sbin/httpd
#20 0x00b8f81c in ap_process_connection () from /usr/sbin/httpd
#21 0x00b9b782 in ap_graceful_stop_signalled () from /usr/sbin/httpd
#22 0x00b9ba91 in ap_graceful_stop_signalled () from /usr/sbin/httpd
#23 0x00b9bb6a in ap_graceful_stop_signalled () from /usr/sbin/httpd
#24 0x00b9c6cb in ap_mpm_run () from /usr/sbin/httpd
#25 0x00b730d7 in main () from /usr/sbin/httpd


any ideas on what I can do to keep it from segfaulting again?

Tyler

Re: backtrace for segfault....

Posted by Perrin Harkins <pe...@elem.com>.
On 5/25/07, Tyler Bird <bi...@epromo.com> wrote:
> Also when I tried to recompile apache since I
> have a redhat rpm install of apache 2.0 and mod_perl when I try and
> compile apache it complains about libapr already being there and exits.

Remove any mod_perl, apache, and libapreq RPMs before you build.

- Perrin

Re: backtrace for segfault....

Posted by Tyler Bird <bi...@epromo.com>.
Clinton Gormley wrote:
>> Clint,
>>
>> I changed the header I sent from text/html to text/plain and the 
>> segfaulting no longer occuring.
>>     
>
> It's more likely to be the headers your server is receiving (eg cookie?)
> than the headers it is sending.
>
>
>   
Clint,  I removed sending any cookies the following script works 
repeatedly now, but when I umcomment the first 4 lines to take the 
template from a file
then it segfaults again.   Also when I tried to recompile apache since I 
have a redhat rpm install of apache 2.0 and mod_perl when I try and 
compile apache it complains about libapr already being there and exits.

#open(FILE, "< tpls/index.tpl");
#my @lines = <FILE>;
#close(FILE);
#my $shell = join("\n", @lines);

print("Content-type: text/html\r\n\r\n");

print qq(

THIS IS MY CONTENT <br />


THIS IS MY CONTENT <br />
THIS IS MY CONTENT <br />
THIS IS MY CONTENT <br />
THIS IS MY CONTENT <br />

<img src="images/invoice.gif">
);




Re: backtrace for segfault....

Posted by Tyler Bird <bi...@epromo.com>.
Clinton Gormley wrote:
>> Clint,
>>
>> I changed the header I sent from text/html to text/plain and the 
>> segfaulting no longer occuring.
>>     
>
> It's more likely to be the headers your server is receiving (eg cookie?)
> than the headers it is sending.
>
>
>   
Ok, I built my own apache-2.2.4 + mod_perl 2.0, first removing the 
libapr system libraries .

Funny thing is now in the logs I have

Apache2::Reload: Can't locate Faked by MRO::Compat

being generated by Apache2::Reload.

Any ideas on how to get rid of this error message?

I also configured apache to load  Apache2::compat
this produced warnings because it expected to find the system apr system 
libraries... should I re-install libapr?

here is the error message.

 > perl -MApache2::compat
Can't load 
'/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/APR/APR.so' 
for module APR: libaprutil-1.so.0: cannot open shared object file: No 
such file or directory at 
/usr/lib/perl5/5.8.8/i386-linux-thread-multi/DynaLoader.pm line 230.
 at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/APR/Date.pm 
line 23
Compilation failed in require at 
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/APR/Date.pm line 23.
BEGIN failed--compilation aborted at 
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/APR/Date.pm line 23.
Compilation failed in require at 
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Apache2/compat.pm 
line 52.
BEGIN failed--compilation aborted at 
/usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Apache2/compat.pm 
line 52.
Compilation failed in require.
BEGIN failed--compilation aborted.

Thanks for any help you can give me.

Tyler


Re: backtrace for segfault....

Posted by Clinton Gormley <cl...@traveljury.com>.
> Clint,
> 
> I changed the header I sent from text/html to text/plain and the 
> segfaulting no longer occuring.

It's more likely to be the headers your server is receiving (eg cookie?)
than the headers it is sending.



Re: backtrace for segfault....

Posted by Tyler Bird <bi...@epromo.com>.
Clinton Gormley wrote:
> Hi Tyler
>
> I know next to nothing about reading backtraces, but it looks to me like
> your segfault is occurring while your program is trying to parse the
> headers.
>
> Before doing any more, I would compile my own version of Apache2,
> mod_perl2 and libapreq2, and see if it still occurs.
>
> With regards your previous question about persistent DB handles, it
> doesn't look to me as though your segfault is from this source, but here
> are some thought anyway:
>
>  - Apache::DBI is supposed to not cache DB connections during startup
>
>  - I remember submitting a patch ages ago
> http://www.issociate.de/board/post/299107/Patch_for_Apache::DBI_v_0.9901_under_MP2_using_prefork.html
>
>    which was not applied.  If I look at the code now, I think it has 
>    changed, so it may well work (I don't use it anymore), but it is 
>    worth testing that it is actually happening.
>
>  - The problem in the original code was that the use of restart_count 
>    did not reflect the situation we were trying to catch. I forget 
>    the details now.
>
>  - Don't forget, if you store a DBI handle in a global during parent,
>    startup and never disconnect it, then it will be live in the 
>    children.
>
>  - It either has to go out of scope, or be manually disconnected (and
>    if you're using Apache::DBI, your disconnect is overridden).
>
> hth
>
> clint
>
> On Thu, 2007-05-24 at 17:34 -0600, Tyler Bird wrote:
>   
>> hey guys I read a little more and was able to generate a backtrace for 
>> my apache children segfaulting here it is below.
>>
>> Program terminated with signal 11, Segmentation fault.
>> #0  0x0051389a in apr_palloc () from /usr/lib/libapr-1.so.0
>> (gdb) bt
>> #0  0x0051389a in apr_palloc () from /usr/lib/libapr-1.so.0
>> #1  0x0050bfed in apr_table_make () from /usr/lib/libapr-1.so.0
>> #2  0x00b8d9bc in ap_scan_script_header_err_core () from /usr/sbin/httpd
>> #3  0x00b8e006 in ap_scan_script_header_err_strs () from /usr/sbin/httpd
>> #4  0x006a60a0 in modperl_cgi_header_parse () from 
>> /etc/httpd/modules/mod_perl.so
>> #5  0x00906544 in XS_Apache2__RequestRec_send_cgi_header ()
>>    from 
>> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/Apache2/Response/Response.so
>> #6  0x0435c43d in Perl_pp_entersub () from 
>> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
>> #7  0x0435589f in Perl_runops_standard ()
>>    from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
>> #8  0x042f5fee in Perl_magicname () from 
>> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
>> #9  0x042fa7e6 in Perl_call_sv () from 
>> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
>> #10 0x0069a77f in modperl_callback () from /etc/httpd/modules/mod_perl.so
>> #11 0x0069ae7a in modperl_callback_run_handlers () from 
>> /etc/httpd/modules/mod_perl.so
>> #12 0x0069b4ea in modperl_callback_per_dir () from 
>> /etc/httpd/modules/mod_perl.so
>> #13 0x0069464f in modperl_response_init () from 
>> /etc/httpd/modules/mod_perl.so
>> #14 0x0069481b in modperl_response_handler_cgi () from 
>> /etc/httpd/modules/mod_perl.so
>> #15 0x00b8785d in ap_run_handler () from /usr/sbin/httpd
>> #16 0x00b8b208 in ap_invoke_handler () from /usr/sbin/httpd
>> #17 0x00b971ce in ap_process_request () from /usr/sbin/httpd
>> #18 0x00b93fbf in ap_register_input_filter () from /usr/sbin/httpd
>> #19 0x00b8f71d in ap_run_process_connection () from /usr/sbin/httpd
>> #20 0x00b8f81c in ap_process_connection () from /usr/sbin/httpd
>> #21 0x00b9b782 in ap_graceful_stop_signalled () from /usr/sbin/httpd
>> #22 0x00b9ba91 in ap_graceful_stop_signalled () from /usr/sbin/httpd
>> #23 0x00b9bb6a in ap_graceful_stop_signalled () from /usr/sbin/httpd
>> #24 0x00b9c6cb in ap_mpm_run () from /usr/sbin/httpd
>> #25 0x00b730d7 in main () from /usr/sbin/httpd
>>
>>
>> any ideas on what I can do to keep it from segfaulting again?
>>
>> Tyler
>>     
Clint,

I changed the header I sent from text/html to text/plain and the 
segfaulting no longer occuring.

What I am doing to reproduce this is 1.) repeatedly refreshing a page.  
2.) refresing page repeatedly but waiting 4 seconds between refreshes I 
get the segfault randomly when I do both cases.

I am  going to recompile next.




Re: backtrace for segfault....

Posted by Clinton Gormley <cl...@traveljury.com>.
Hi Tyler

I know next to nothing about reading backtraces, but it looks to me like
your segfault is occurring while your program is trying to parse the
headers.

Before doing any more, I would compile my own version of Apache2,
mod_perl2 and libapreq2, and see if it still occurs.

With regards your previous question about persistent DB handles, it
doesn't look to me as though your segfault is from this source, but here
are some thought anyway:

 - Apache::DBI is supposed to not cache DB connections during startup

 - I remember submitting a patch ages ago
http://www.issociate.de/board/post/299107/Patch_for_Apache::DBI_v_0.9901_under_MP2_using_prefork.html

   which was not applied.  If I look at the code now, I think it has 
   changed, so it may well work (I don't use it anymore), but it is 
   worth testing that it is actually happening.

 - The problem in the original code was that the use of restart_count 
   did not reflect the situation we were trying to catch. I forget 
   the details now.

 - Don't forget, if you store a DBI handle in a global during parent,
   startup and never disconnect it, then it will be live in the 
   children.

 - It either has to go out of scope, or be manually disconnected (and
   if you're using Apache::DBI, your disconnect is overridden).

hth

clint

On Thu, 2007-05-24 at 17:34 -0600, Tyler Bird wrote:
> hey guys I read a little more and was able to generate a backtrace for 
> my apache children segfaulting here it is below.
> 
> Program terminated with signal 11, Segmentation fault.
> #0  0x0051389a in apr_palloc () from /usr/lib/libapr-1.so.0
> (gdb) bt
> #0  0x0051389a in apr_palloc () from /usr/lib/libapr-1.so.0
> #1  0x0050bfed in apr_table_make () from /usr/lib/libapr-1.so.0
> #2  0x00b8d9bc in ap_scan_script_header_err_core () from /usr/sbin/httpd
> #3  0x00b8e006 in ap_scan_script_header_err_strs () from /usr/sbin/httpd
> #4  0x006a60a0 in modperl_cgi_header_parse () from 
> /etc/httpd/modules/mod_perl.so
> #5  0x00906544 in XS_Apache2__RequestRec_send_cgi_header ()
>    from 
> /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/auto/Apache2/Response/Response.so
> #6  0x0435c43d in Perl_pp_entersub () from 
> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
> #7  0x0435589f in Perl_runops_standard ()
>    from /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
> #8  0x042f5fee in Perl_magicname () from 
> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
> #9  0x042fa7e6 in Perl_call_sv () from 
> /usr/lib/perl5/5.8.8/i386-linux-thread-multi/CORE/libperl.so
> #10 0x0069a77f in modperl_callback () from /etc/httpd/modules/mod_perl.so
> #11 0x0069ae7a in modperl_callback_run_handlers () from 
> /etc/httpd/modules/mod_perl.so
> #12 0x0069b4ea in modperl_callback_per_dir () from 
> /etc/httpd/modules/mod_perl.so
> #13 0x0069464f in modperl_response_init () from 
> /etc/httpd/modules/mod_perl.so
> #14 0x0069481b in modperl_response_handler_cgi () from 
> /etc/httpd/modules/mod_perl.so
> #15 0x00b8785d in ap_run_handler () from /usr/sbin/httpd
> #16 0x00b8b208 in ap_invoke_handler () from /usr/sbin/httpd
> #17 0x00b971ce in ap_process_request () from /usr/sbin/httpd
> #18 0x00b93fbf in ap_register_input_filter () from /usr/sbin/httpd
> #19 0x00b8f71d in ap_run_process_connection () from /usr/sbin/httpd
> #20 0x00b8f81c in ap_process_connection () from /usr/sbin/httpd
> #21 0x00b9b782 in ap_graceful_stop_signalled () from /usr/sbin/httpd
> #22 0x00b9ba91 in ap_graceful_stop_signalled () from /usr/sbin/httpd
> #23 0x00b9bb6a in ap_graceful_stop_signalled () from /usr/sbin/httpd
> #24 0x00b9c6cb in ap_mpm_run () from /usr/sbin/httpd
> #25 0x00b730d7 in main () from /usr/sbin/httpd
> 
> 
> any ideas on what I can do to keep it from segfaulting again?
> 
> Tyler