[mp1] PerlCleanupHandler in .htaccess file sometimes doesn't run

2003-06-08 Thread Bradley Baetz
I've run into an interesting bug in mp1. If I have a PerlCleanupHandler
defined in a .htaccess file, then it won't run if there was a
PerlInitHandler defined in httpd.conf. It doesn't matter what the
PerlInitHandler does, as long as its there the cleanup fails. If I have
the init handler run from within the .htaccess, its all fine, and it
also works if I have a PerlLogHandler in .htaccess instead of a
PerlCleanupHandler.

I'll attach two test files. Foo.pm is loading via PerlModule in
httpd.conf, and I have |PerlInitHandler Foo->init|. I first noticed this
with Apache::Reload, but any init handler will do it.

With the init handler, I get lines in error_log for init, Request, and
cleanup1. Without, I get lines for Request, cleanup1, and then the die.
The cleanup1 handler was just for testing; removing it doesn't affect
the results.

I'm testing with RH9's perl 5.8.0, and cvs mod_perl/1.27_01-dev from
about 12 hours ago, with a self compiled apache_1.3.27. This also
happened with mp/1.27, but doesn't happen with mp2 (After I port my test
modules to mp2). mod_perl is built as a .so with

perl Makefile.PL USE_APXS=1 WITH_APXS=/usr/local/apache/bin/apxs
EVERYTHING=1

Thanks,

Bradley

PS Is there a way to subscribe to this list so that I can post, but not
receive any mails? I couldn't find a nomail option on the list page at
perl.apache.org. I've subscribed to the digest version for now.
package Foo;

use Apache;

sub init($$) : method {
warn "init";
return Apache::OK;
}

sub cleanup($$) : method {
die "XXX";

return Apache::OK;
}

1;
#!/usr/bin/perl -w

use lib qw(.);

use strict;

use warnings;

use Foo;

sub cleanup1 {
warn "cleanup1";

return Apache::OK;
}

Apache->request->register_cleanup(\&cleanup1);

Apache->request->send_http_header('text/plain');

warn "Request";

print "HI!";
  SetHandler perl-script
  PerlHandler Apache::Registry
  Options ExecCGI
  allow from all
  #PerlInitHandler Foo->init
  PerlCleanupHandler Foo->cleanup


[mp2] segfault deleting ENV variable

2002-10-15 Thread Bradley Baetz

The following one line script will cause apache/mod_perl2 to segfault:

delete @::ENV{'PATH'};

I've tried this with both apache-2.0.40/mod_perl-1.99_05/perl-5.8.0 (ie
stock RH8), and apache-2.0.43/mod_perl-1.99_07/perl-5.8.0

A backtrace from the later combination gives:

#0  0x4024b447 in Perl_mg_clear ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#1  0x40253989 in Perl_hv_delete_ent ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#2  0x4027ff27 in Perl_pp_delete ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#3  0x40258059 in Perl_runops_standard ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#4  0x40200139 in S_call_body ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#5  0x401ffeb6 in Perl_call_sv ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#6  0x401c85f2 in modperl_callback ()
   from /usr/local/apache2/modules/mod_perl.so
#7  0x401c8abe in modperl_callback_run_handlers ()
   from /usr/local/apache2/modules/mod_perl.so
#8  0x401c8d05 in modperl_callback_per_dir ()
   from /usr/local/apache2/modules/mod_perl.so
#9  0x401c4a55 in modperl_response_handler_run ()
   from /usr/local/apache2/modules/mod_perl.so
#10 0x401c4c75 in modperl_response_handler_cgi ()
   from /usr/local/apache2/modules/mod_perl.so
#11 0x0807c4f0 in ap_run_handler (r=0x8160178) at config.c:195
#12 0x0807cad6 in ap_invoke_handler (r=0x8160178) at config.c:401
#13 0x0806afc7 in ap_process_request (r=0x8160178) at http_request.c:288
#14 0x08066be1 in ap_process_http_connection (c=0x815bd10) at 
http_core.c:293
#15 0x08086268 in ap_run_process_connection (c=0x815bd10) at 
connection.c:85
#16 0x08086555 in ap_process_connection (c=0x815bd10, csd=0x815bc40)
at connection.c:207
#17 0x0807ae0d in child_main (child_num_arg=1651076143) at prefork.c:696
#18 0x0807afd4 in make_child (s=0x80b9358, slot=0) at prefork.c:736
#19 0x0807b041 in startup_children (number_to_start=5) at prefork.c:808
#20 0x0807b7bf in ap_mpm_run (_pconf=0x80ab53c, plog=0x80eed30, 
s=0x80b9358)
at prefork.c:1024
#21 0x08080d8e in main (argc=2, argv=0xb924) at main.c:643
#22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6

I built apache with debug info, but forgot to build mod_perl that way. The 
above one liner script should be enough to reproduce this, though.

This happens in PerlRun or Registry mode. It isn't restricted to the PATH
variable; deleting any existing ENV var causes the crash.

Thanks,

Bradley