Re: Apache::Registry spawning zombie shells?

2000-08-30 Thread Doug MacEachern

On Tue, 22 Aug 2000, martin langhoff wrote:

> hi list,
> 
>   while doing a silly thing (building a set of HTML files with info from
> a DB file), I found that while the apache server was being crawled by
> lwp-rget, a lots of zombie shells were being spawned and killed. 
 
> sh -c /bin/csh -cf 'set nonomatch; glob /table' 2>/de

it looks like one of your html tags is astray, which Perl interprets as
a <> glob, e.g.

% strace -o strace.out -f /usr/bin/perl -e ''
% grep glob strace.out 
10627 execve("/bin/csh", ["/bin/csh", "-cf", "set nonomatch; glob /table"], [/* 56 
vars */]) = 0

i don't see any in your script that would trigger that, but you might want
to double check where all of your  tags are.




Apache::Registry spawning zombie shells?

2000-08-22 Thread martin langhoff

hi list,

while doing a silly thing (building a set of HTML files with info from
a DB file), I found that while the apache server was being crawled by
lwp-rget, a lots of zombie shells were being spawned and killed. 

top was telling me that there were quite a few processes like:

 6766 nobody 2   0 00 0 Z   0  0.3  0.0   0:00 sh


(I was looking at top because I was happy thinking how mod_perl was
speeding it all up)

so I checked and rechecked my code, 2 *very* silly cgi scripts hacked
in a hurry, that I renamed from .cgi to .pl so the crawling finished
faster. the scripts are at the bottom, but I don't think you'll find
much there. 

needless to say, when run under mod_cgi, no sh is ever spawned, and
when the crawling finished no more spawning took place (3 of the zombie
shells remained, though). So it's definitely something with mod_perl and
Apache::Registry. Maybe the DB_File module has something blame? Don't
really know.

these shells are not attached to any console, and they are sh shells,
while I use bash. queer. If it weren't because the server is
*disconnected* from the 'net I'd think the box was 'rooted'.

I've even got to catch the actuall call to sh from ps:

sh -c /bin/csh -cf 'set nonomatch; glob /table' 2>/de

what can that mean? I'm off to search ... 


martin

system specs and scripts : 'Apache/1.3.12 (Unix) mod_perl/1.24'
--
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=linux, osvers=2.2.5-22smp, archname=i386-linux
uname='linux porky.devel.redhat.com 2.2.5-22smp #1 smp wed jun 2
09:11:51 ed
t 1999 i686 unknown '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-O2', gccversion=egcs-2.91.66 19990314/Linux
(egcs-1.1.2
release)
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=undef, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -ldl -lm -lc -lposix -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Built under linux
  Compiled at Aug 30 1999 23:09:51
  @INC:
/usr/lib/perl5/5.00503/i386-linux
/usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i386-linux
/usr/lib/perl5/site_perl/5.005



script letra.pl:
---
#!/usr/bin/perl -w


use strict;
use DB_File;


use CGI;
use URI::Escape;

my $cgi = new CGI;
print $cgi->header();
my $letra = $cgi->param('letra');
my %db;

my $records = 0;

tie (%db, "DB_File", 'voluntarios.db') or die $!; 

print '';
print '';

foreach my $key (sort { lc($a) cmp lc($b) } keys %db){
if ($key =~ /^$letra/io){
$records++; 
print '




';
print $cgi->a( {href=>'record.pl?record=' . uri_escape($key)} ,
qq{$key});
print '';
}
};
unless ($records){
$letra = uc $letra;
print '




';
print qq{No hay registros con la letra $letra};
print '';
}
print '';


print '';
--
script record.pl
--
#!/usr/bin/perl -w


use strict;
use DB_File;


use CGI;
use URI::Escape;

my $cgi = new CGI;
print $cgi->header();
my $record = $cgi->param('record');
my %db;
tie (%db, "DB_File", 'voluntarios.db') or die $!; 

print '';
print qq{


   $record

  
};

print ' ';

# elimino la 1er línea del record
my $data = $db{$record};
$data =~ s/^.+\n//;
$data =~ s/^.+\n//;