You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by on 2000/04/13 00:08:57 UTC
Problem with Apache::SIG
Hi All,
Recently I installed Apache-1.3.12 with mod_perl-1.22. Standard
installation. Everything seemed to work great.
I'm using the directive
PerlFixupHandler Apache::SIG
because you have some 'alive' scripts that need to be killed if
the user closes his browser.
Well, everything seems to work fine, but in Apache error_log
we get the message:
[Mon Apr 10 22:27:01 2000] [error] at
/usr/lib/perl5/site_perl/5.005/i386-linux
/Apache/SIG.pm line 31.
Line 31 is Apache::exit($s);
What is wrong ?
Thanks in advance,
Renato - Brasil
Re: Problem with Apache::SIG
Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 28 Sep 2000, Bill Moseley wrote:
> Nope. I just downloaded a fresh 1.24, and 1.3.12 and built with
ah, it happens for non-Registry handlers. patch below fixes. you can
also change your handler to:
sub handler {
my $r = shift;
$r->exit(HTTP_NOT_MODIFIED);
}
> BTW --disable-module=include causes:
> modules/ssi.........FAILED before any test output arrived
>
> Any way to detect that SSI is disabled and not run the test?
yeah, i'll fix that.
Index: src/modules/perl/mod_perl.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.c,v
retrieving revision 1.129
diff -u -r1.129 mod_perl.c
--- src/modules/perl/mod_perl.c 2000/09/27 16:13:28 1.129
+++ src/modules/perl/mod_perl.c 2000/09/29 16:24:42
@@ -1654,14 +1654,17 @@
SPAGAIN;
- if(perl_eval_ok(r->server) != OK) {
- dTHRCTX;
- MP_STORE_ERROR(r->uri, ERRSV);
- if (r->notes) {
- ap_table_set(r->notes, "error-notes", SvPVX(ERRSV));
+ if ((status = perl_eval_ok(r->server)) != OK) {
+ dTHRCTX;
+ if (status == SERVER_ERROR) {
+ MP_STORE_ERROR(r->uri, ERRSV);
+ if (r->notes) {
+ ap_table_set(r->notes, "error-notes", SvPVX(ERRSV));
+ }
}
- if(!perl_sv_is_http_code(ERRSV, &status))
- status = SERVER_ERROR;
+ else if (status == DECLINED) {
+ status = r->status == 200 ? OK : r->status;
+ }
}
else if(count != 1) {
mod_perl_error(r->server,
Index: src/modules/perl/perl_util.c
===================================================================
RCS file: /home/cvs/modperl/src/modules/perl/perl_util.c,v
retrieving revision 1.42
diff -u -r1.42 perl_util.c
--- src/modules/perl/perl_util.c 2000/09/28 21:00:47 1.42
+++ src/modules/perl/perl_util.c 2000/09/29 16:24:48
@@ -677,17 +677,27 @@
int perl_eval_ok(server_rec *s)
{
+ int status;
SV *sv;
dTHR;
dTHRCTX;
sv = ERRSV;
- if(SvTRUE(sv)) {
- MP_TRACE_g(fprintf(stderr, "perl_eval error: %s\n", SvPV(sv,na)));
- mod_perl_error(s, SvPV(sv, na));
- return -1;
+ if (SvTRUE(sv)) {
+ /* Apache::exit was called */
+ if (SvMAGICAL(sv) && (SvCUR(sv) > 4) &&
+ strnEQ(SvPVX(sv), " at ", 4))
+ {
+ return DECLINED;
+ }
+ if (perl_sv_is_http_code(ERRSV, &status)) {
+ return status;
+ }
+ MP_TRACE_g(fprintf(stderr, "perl_eval error: %s\n", SvPV(sv,na)));
+ mod_perl_error(s, SvPV(sv, na));
+ return SERVER_ERROR;
}
- return 0;
+ return OK;
}
int perl_sv_is_http_code(SV *errsv, int *status)
Re: Problem with Apache::SIG
Posted by Bill Moseley <mo...@hank.org>.
At 01:43 PM 09/28/00 -0700, Doug MacEachern wrote:
>On Thu, 28 Sep 2000, Bill Moseley wrote:
>
>> Is there a way to make that message go away?
>
>maybe if you can give me a small example that reproduces the message. it
>works fine for me:
package My::Hello;
use strict;
use Apache::Constants qw(HTTP_NOT_MODIFIED);
sub handler {
my $r = shift;
$r->status( HTTP_NOT_MODIFIED );
$r->exit;
}
PerlFreshRestart On
PerlTaintCheck On
PerlWarn On
<Location />
PerlSendHeader off
SetHandler perl-module
PerlHandler My::Hello
Allow from all
</Location>
1;
GET / http/1.0
HTTP/1.1 304 Not Modified
Date: Thu, 28 Sep 2000 22:18:36 GMT
Server: Apache/1.3.12 (Unix) mod_perl/1.24
Connection: close
[Thu Sep 28 15:18:36 2000] [error] at /data/_g/lii/My/Hello.pm line 8.
>actually, the patch below might fix it. lemme know.
Nope. I just downloaded a fresh 1.24, and 1.3.12 and built with
perl Makefile.PL \
APACHE_SRC=../apache_1.3.12/src \
DO_HTTPD=1 \
USE_APACI=1 \
EVERYTHING=1 \
APACI_ARGS='--enable-module=rewrite --disable-module=include'
BTW --disable-module=include causes:
modules/ssi.........FAILED before any test output arrived
Any way to detect that SSI is disabled and not run the test?
Bill Moseley
mailto:moseley@hank.org
Re: Problem with Apache::SIG
Posted by Doug MacEachern <do...@covalent.net>.
On Thu, 28 Sep 2000, Bill Moseley wrote:
> Is there a way to make that message go away?
maybe if you can give me a small example that reproduces the message. it
works fine for me:
shift->send_http_header;
print "hi\n";
exit;
print "bye\n";
nothing in the error_log.
actually, the patch below might fix it. lemme know.
--- src/modules/perl/perl_util.c 2000/08/15 19:36:34 1.41
+++ src/modules/perl/perl_util.c 2000/09/28 20:43:14
@@ -424,7 +424,7 @@
static I32
errgv_empty_set(IV ix, SV* sv)
{
- sv_setpv(sv, "");
+ sv_setsv(sv, &sv_no);
return TRUE;
}
Re: Problem with Apache::SIG
Posted by Bill Moseley <mo...@hank.org>.
At 01:25 PM 04/20/00 -0700, Doug MacEachern wrote:
>On Wed, 12 Apr 2000 modperl-return-2783-dougm=pobox.com@apache.org wrote:
>
>> Hi All,
...
>> [Mon Apr 10 22:27:01 2000] [error] at
>> /usr/lib/perl5/site_perl/5.005/i386-linux/Apache/SIG.pm line 31.
>>
>> Line 31 is Apache::exit($s);
>
>Apache::exit() calls die() underneath to halt script execution. it tie's
>$@ so it appears empty to avoid such messages, somehow the magic was lost.
>so the message in this case is nothing more than annoying.
Is there a way to make that message go away?
sub check_not_modified {
my $r = shift;
...
$r->status( HTTP_NOT_MODIFIED );
$r->exit;
}
Since check_not_modified() may be a number of subs deep I now must return a
code that heads back to the initial handler where it can simply return
HTTP_NOT_MODIFIED, but it would be better to just exit().
Is there a better way to exit?
Bill Moseley
mailto:moseley@hank.org
Re: Problem with Apache::SIG
Posted by Stas Bekman <sb...@stason.org>.
On Wed, 12 Apr 2000 modperl-return-2783-stas=stason.org@apache.org wrote:
> Hi All,
>
> Recently I installed Apache-1.3.12 with mod_perl-1.22. Standard
> installation. Everything seemed to work great.
>
> I'm using the directive
> PerlFixupHandler Apache::SIG
>
> because you have some 'alive' scripts that need to be killed if
> the user closes his browser.
>
> Well, everything seems to work fine, but in Apache error_log
> we get the message:
>
> [Mon Apr 10 22:27:01 2000] [error] at
> /usr/lib/perl5/site_perl/5.005/i386-linux
> /Apache/SIG.pm line 31.
>
> Line 31 is Apache::exit($s);
>
> What is wrong ?
Try to install the die call tracer in the startup file to reveal where the
error comes from:
use Carp qw(verbose);
$SIG{__DIE__} = \&Carp::confess;
Use it only to trace this problem, remove this setting when you are done.
You might want to read the explanation of the problems you might get into
when using __DIE__ by Matt Sergeant from a few weeks ago. The new version
of the Guide will include it.
______________________________________________________________________
Stas Bekman | JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ | mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org | http://perl.org http://stason.org/TULARC/
http://singlesheaven.com| http://perlmonth.com http://sourcegarden.org
----------------------------------------------------------------------
Re: Problem with Apache::SIG
Posted by Bill Jones <bi...@fccj.org>.
on 4/12/00 6:08 PM, modperl-return-2783-bill=fccj.org@apache.org at
modperl-return-2783-bill=fccj.org@apache.org wrote:
Why is my address in there????
See -
modperl-return-2783-bill=fccj.org@apache.org
????
- FCCJ * 501 W State St * Jacksonville, Fl 32202 * 904/632-3089 -
Re: Problem with Apache::SIG
Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 12 Apr 2000 modperl-return-2783-dougm=pobox.com@apache.org wrote:
> Hi All,
>
> Recently I installed Apache-1.3.12 with mod_perl-1.22. Standard
> installation. Everything seemed to work great.
>
> I'm using the directive
> PerlFixupHandler Apache::SIG
>
> because you have some 'alive' scripts that need to be killed if
> the user closes his browser.
>
> Well, everything seems to work fine, but in Apache error_log
> we get the message:
>
> [Mon Apr 10 22:27:01 2000] [error] at
> /usr/lib/perl5/site_perl/5.005/i386-linux
> /Apache/SIG.pm line 31.
>
> Line 31 is Apache::exit($s);
Apache::exit() calls die() underneath to halt script execution. it tie's
$@ so it appears empty to avoid such messages, somehow the magic was lost.
so the message in this case is nothing more than annoying.