You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Yusuf Goolamabbas <yu...@outblaze.com> on 2001/05/07 09:46:53 UTC

Trying to trace a spinning httpd

Apache 1.3.19/Mod-perl 1.25 under Linux 2.2.19

Hi, I am trying to better understand Apache/mod-perl behaviour under
this scenario. I have some CGI's which connect to various servers
listening on different ports and collect the output and push them to
the clients. Whilst the data is streaming from the server to the CGI,
I kill the server. After a few seconds, I see httpd take up increasing
amount of CPU time [it can go up to 90% of CPU]. straceing the httpd
process shows that it is continuously in a read call to the file
descriptor representing the connection it was last in

I ran httpd in single instance mode [httpd -X] and attached gdb to
it. I sourced .gdbinit and typed curinfo
This is what I get 

(gdb) curinfo
Attempt to extract a component of a value that is not a structure
pointer.

A backtrace shows this

(gdb) bt
#0  0x4015eab4 in __libc_read () from /lib/libc.so.6
#1  0x401a81cc in ?? () from /lib/libc.so.6
#2  0x4010d931 in _IO_new_file_underflow (fp=0x8e0db18) at fileops.c:385
#3  0x4010f881 in _IO_default_uflow (fp=0x8e0db18) at genops.c:371
#4  0x4010ecec in __uflow (fp=0x8e0db18) at genops.c:328
#5  0x4010c046 in _IO_getc (fp=0x8e0db18) at getc.c:39
#6  0x80ee671 in Perl_sv_gets ()
#7  0x80e763e in Perl_do_readline ()
#8  0x80e574b in Perl_pp_readline ()
#9  0x81149dd in Perl_runops_standard ()
#10 0x80b9a31 in perl_call_sv ()
#11 0x80743eb in perl_call_handler ()
#12 0x8073bcb in perl_run_stacked_handlers ()
#13 0x8071f9d in perl_handler ()
#14 0x808eb03 in ap_invoke_handler ()
#15 0x80a2639 in process_request_internal ()
#16 0x80a269c in ap_process_request ()
#17 0x8099c7e in child_main ()
#18 0x8099e0c in make_child ()
#19 0x8099f69 in startup_children ()
#20 0x809a5a6 in standalone_main ()
#21 0x809ad33 in main ()
#22 0x400d09cb in __libc_start_main (main=0x809a9ec <main>, argc=2, 

Having the following code and sending a SIGUSR2 also did not help
use Carp ();
$SIG{'USR2'} = sub { 
Carp::confess("caught SIGUSR2!");
};

I am looking for ideas to determine where in the perl code could I be
spinning and is there a way for me to tell Apache to recognise that
the other end has shutdown

Regards, Yusuf

-- 
Yusuf Goolamabbas
yusufg@outblaze.com

Re: Trying to trace a spinning httpd

Posted by Doug MacEachern <do...@covalent.net>.
On 7 May 2001, Yusuf Goolamabbas wrote:

> Apache 1.3.19/Mod-perl 1.25 under Linux 2.2.19
> 
> Hi, I am trying to better understand Apache/mod-perl behaviour under
> this scenario. I have some CGI's which connect to various servers
> listening on different ports and collect the output and push them to
> the clients. Whilst the data is streaming from the server to the CGI,
> I kill the server. After a few seconds, I see httpd take up increasing
> amount of CPU time [it can go up to 90% of CPU]. straceing the httpd
> process shows that it is continuously in a read call to the file
> descriptor representing the connection it was last in
> 
> I ran httpd in single instance mode [httpd -X] and attached gdb to
> it. I sourced .gdbinit and typed curinfo
> This is what I get 
> 
> (gdb) curinfo
> Attempt to extract a component of a value that is not a structure
> pointer.

what is your perl -V?
you might need to move up the stack first:
(gdb) up 7
(gdb) curinfo
 
> #8  0x80e574b in Perl_pp_readline ()

this would be the <> operator, did you check the return value from
whatever you use to connect to the socket ?  what are you using to connect
to these various servers?