piece of code in mod_perl guide

2001-10-06 Thread pascal barbedor



hello,
 
I am reading mod_perl guide and i had a problem 
with a piece of code in chapter 9.7.4.2 about 
reloading configuration files. this is version jan 
2001 but i have checked in the last one the piece of code is the 
same.
 
when running the code exactly, things don't work, 
even outside mod_perl environnment.
 
the sub below print  file is different even 
though I don't change the file.
 
I have located that if i change  $MODIFIED{$file} = -M _;   
to  an explicit  $MODIFIED{$file} = -M 
$file;
 
in the last line, everything works 
fine.
 
 
since i do no test on any other file and I have 
understood that _ account s for the last file tested, I don't understand why it 
does work.
I am on NT4 perl 5.6.1
try it yourself ! so strange !
 
 
thanks for any explanation
 
 
*
 
for (1..10){
 
reread_conf("l:/asperl/site/lib/afpa/evolif/config.pm");
 
sleep 2;
 
}
 
 
 
our %MODIFIED;
sub reread_conf{
 
 my $file=shift;
 
 return unless $file;
 
 return unless -e $file and -r _;
 
 if ($MODIFIED{$file} and $MODIFIED{$file}== 
-M _){
 
 print  "same" ; }else {print 
"different";}
 
 print "\n";
 
 unless ($MODIFIED{$file} and 
$MODIFIED{$file}== -M _){
    unless (my $result = do $file) {
    warn ...
 
 }
 
  print "\nmod:",$MODIFIED{$file},' 
:', -M _,"\n";
 
    $MODIFIED{$file} = -M 
_;
 
 }
 
}
 
 


how to catch a killed task?

2001-10-06 Thread Christoph Bergmann

hi...

i use BSD::Resource to limit the ressources of the apache tasks. this
works fine but now i want to clean up afterwards but i don't know how to
catch a killed task... here is what i tried with signals:

my entries in httpd.conf:

PerlModule Apache::Resource
PerlSetEnv PERL_RLIMIT_CPU 120:150
PerlSetEnv PERL_RLIMIT_AS 3000:3500
PerlChildInitHandler Apache::Resource

and this is how i tried to catch the signals:

sub cleanup { die "cleanup called..."; }
$SIG{XFSZ} = \&cleanup;

i use linux, thus i have to use RLIMIT_AS and so maybe XFSZ is the wrong
signal for the RAM limit. which do i have to use then?

but i tried $SIG{XCPU} but it doesnt work as well.

it just killed the task at soft limit without calling "cleanup". what is
wrong?

or is there another possibility for cleaning up? probably there is a
handler i can use which will be called when a program is finished, if
so, how can i check if the program has ended as it shoulds or if it was
killed by BSD::resource ?

thanx in advance!

best regards,

christoph bergmann



Apache::Request coredumps on FreeBSD

2001-10-06 Thread Ask Bjoern Hansen

Hi,

I am using FreeBSD 4.4.  My newly build httpd coredumps when I load
Apache::Request.  Any clues would be most appreciated.  bt, build
parameters for perl, apache and mod_perl and perl -V output below.

 - ask

$ gdb /home/perl/apache/bin/httpd
(gdb) run -X [...]
0x282f8f13 in boot_Apache__Request ()
   from /home/perl/lib/site_perl/5.6.1/i386-freebsd/auto/Apache/Request/Request.so
(gdb) bt
#0  0x282f8f13 in boot_Apache__Request ()
   from /home/perl/lib/site_perl/5.6.1/i386-freebsd/auto/Apache/Request/Request.so
#1  0x2826de93 in Perl_pp_entersub () from /home/allbooks/apache/libexec/libperl.so
#2  0x282687be in Perl_runops_standard () from /home/allbooks/apache/libexec/libperl.so
#3  0x2822ba0a in S_call_body () from /home/allbooks/apache/libexec/libperl.so
#4  0x2822bb46 in perl_eval_sv () from /home/allbooks/apache/libexec/libperl.so
#5  0x2821337d in perl_require_module () from /home/allbooks/apache/libexec/libperl.so
#6  0x2820ecb8 in perl_cmd_module () from /home/allbooks/apache/libexec/libperl.so
#7  0x8054433 in invoke_cmd ()
#8  0x805489d in ap_handle_command ()
#9  0x805493b in ap_srm_command_loop ()
#10 0x8054fef in ap_process_resource_config ()
#11 0x8055930 in ap_read_config ()
#12 0x805ff29 in main ()
#13 0x804e251 in _start ()


I build my perl, apache and mod_perl like the following and then
installed libapreq 0.33 with ~perl/bin/perl Makefile.PL && make &&
make install.


#!/bin/sh
cd src
PERL_VERSION=5.6.1
curl -z perl-$PERL_VERSION.tar.gz -O 
ftp://ftp.perl.org/pub/CPAN/src/perl-$PERL_VERSION.tar.gz \
&& tar xzf perl-$PERL_VERSION.tar.gz
&& cd perl-$PERL_VERSION \
&& ./Configure -Dprefix=/home/perl -Uuselargefiles -des \
&& make -j5 \
&& make test \
&& make install

...

#!/bin/sh
APACHE_VERSION=1.3.20
MODPERL_VERSION=1.26
cd src
curl -z apache_$APACHE_VERSION.tar.gz -O 
http://www.apache.org/dist/httpd/apache_$APACHE_VERSION.tar.gz && \
curl -z mod_perl-$MODPERL_VERSION.tar.gz -O 
http://www.apache.org/dist/perl/mod_perl-$MODPERL_VERSION.tar.gz && \
tar xzf apache_$APACHE_VERSION.tar.gz && \
tar xzf mod_perl-$MODPERL_VERSION.tar.gz && \
\
cd ~/src/apache_$APACHE_VERSION && \
\
./configure --prefix=/home/perl/apache --enable-shared=max \
   --enable-module=all --disable-rule=EXPAT \
   --with-perl=/home/perl/bin/perl \
&& \
make -j4 && make install \
&& \
cd ~/src/mod_perl-$MODPERL_VERSION && \
~/bin/perl Makefile.PL \
   APACHE_SRC=/home/perl/src/apache_$APACHE_VERSION/src/ \
   USE_APXS=1 \
   WITH_APXS=/home/perl/apache/bin/apxs \
   EVERYTHING=1 && \
make && make test && make install && \
cd ~/src && \
curl -O http://develooper.com/code/mpaf/mod_proxy_add_forward.c && \
../apache/bin/apxs -i -c mod_proxy_add_forward.c



$ /home/perl/bin/perl -V

Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
  Platform:
osname=freebsd, osvers=4.4-rc, archname=i386-freebsd
uname='freebsd miette.develooper.com 4.4-rc freebsd 4.4-rc #5: wed sep 12 03:15:29 
pdt 2001 [EMAIL PROTECTED]:homeusrobjusrsrcsysmiette i386 '
config_args='-Dprefix=/home/perl -Uuselargefiles -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=undef usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include',
optimize='-O',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.3 20010315 (release) [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags ='-Wl,-E  -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lgdbm -ldb -lm -lc -lcrypt -liconv -lutil
perllibs=-lm -lc -lcrypt -liconv -lutil
libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fpic', lddlflags='-shared  -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options:
  Built under freebsd
  Compiled at Oct  6 2001 03:42:33
  @INC:
/home/perl/lib/5.6.1/i386-freebsd
/home/perl/lib/5.6.1
/home/perl/lib/site_perl/5.6.1/i386-freebsd
/home/perl/lib/site_perl/5.6.1
/home/perl/lib/site_perl
.


-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();