You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Aaron Trevena <aa...@tuskerdirect.com> on 2003/04/08 13:15:44 UTC

apache segfault at startup when using DBI and CGI

Guys,

I have an intereresting problem.... and a solution we're not to happy 
with...

problem :
------------

we have a modperl startup file that calls all the usual perl modules 
(Apache::Registry, etc) and Apache::DBI.

we want to ensure that we can disable apache::dbi before we upgrade the 
module on the live server (in case the new version has issues with our 
system and/or oracle).

so naturally we tried out a startup.pl script on the RC box (same 
machine, same apache binary, different IP, logdir, rootdir, etc) that 
had all Apache::DBI references commented out and teh server segfaults 
when started with or without -X but works just fine with the original 
startup.pl file.

the server segfaults before any requests to the server are made

a quick grep through the perl modules and cgi scripts give no obvious 
references to apache::dbi

solution :
-----------

after much trimming of startup.pl we got down to this :

# segfault a go-go
use CGI qw(-compile);
use DBI;

# alive-alive-oh
use DBI;
use CGI qw(-compile);

Questions :
--------------

anybody else having this problem or is it just us ?

Other Info:
--------------
Apache 1.3.26
mod_perl 1.26
DBI 1.21
CGI 2.7.52

also using mod_layout version 3.03

regards,

A.




Re: Apache::Request question

Posted by Martin Moss <Ma...@btinternet.com>.
Vince,

you are an absolute star!!!!
I am indeed suffering from a sub_req. And $r->main did indeed help me get
back to my Object.

I've been stressing over this for weeks, I may actually get a decent nights
sleep tonight!

Thank you

Marty

----- Original Message -----
From: "Vince Veselosky" <vi...@control-escape.com>
To: "Martin Moss" <ma...@btinternet.com>
Cc: <mo...@perl.apache.org>; <us...@httpd.apache.org>
Sent: Tuesday, April 08, 2003 3:50 PM
Subject: Re: Apache::Request question


> I had a similar experience recently when one of my handlers was getting
> executed twice for each request, with different request objects each
> time. It turned out that something (in my case mod_dir) was generating a
> subrequest (at the fixup stage), which creates a new Apache object.  I
> suspect that the unexpected subrequest is also biting you.
>
> Perhaps you can test using $r->is_main to see if the request is or is
> not a subrequest. If it is, you can use $r->prev or $r->main to get at
> the originating request, if that is what you need. (It's a shame that
> $r->main returns undef instead of a reference to itself in the main
> request, it would be useful to always be able to get ahold of the main
> request that way instead of all the testing.)
>
> Hope that helps you!
> -Vince Veselosky
> http://ice.control-escape.com
>
>
> Martin Moss wrote:
>
> >All,
> >
> >
> >During one complete cycle of a Request, e.g.
> >authen handler -> authz handler -> method handler
> >
> >should/does Apache give the same 'Apache' Object to my code.
> >e.g. If I dump the Apache object at the start of each 'handler' should I
> >expect to see the following identical line?:-
> >$VAR1 = bless( do{\(my $o = 145577148)}, 'Apache' );
> >
> ><incidentally can anybody tell me what the $o refers to?>
> >
> >The reason I ask is, that I don't see this behaviour. The first two
handlers
> >(authen and authz) have the same one, but I get a new Apache Object for
my
> >method handler.
> >This is causing me grief because it means that when I do an
> >Apache::request->instance($r) I get a NEW Apache::Request object not  the
> >same INSTANCE I was getting for the first two phases, and indeed
expecting
> >to get for each phase of the request cycle (I editted the
> >Apache::Request->instance subroutine to print a warning whenever it can't
> >find the previous object in the pnotes, and it is definitely creating a
new
> >object).
> >Also, The Apache::Request Object that is created based upon the new
Apache
> >Object doesn't go out of scope until I stop apache. Which doesnt' seem
> >right.
> >
> >I am not calling the child_terminate anywhere and so I am confused as to
> >whether this is standard behaviour or not.
> >
> >Can anybody throw me a light on this one?
> >
> >Marty
> >
> >
> >
> >
> >
>
>


[users@httpd] Re: Apache::Request question

Posted by Martin Moss <Ma...@btinternet.com>.
Vince,

you are an absolute star!!!!
I am indeed suffering from a sub_req. And $r->main did indeed help me get
back to my Object.

I've been stressing over this for weeks, I may actually get a decent nights
sleep tonight!

Thank you

Marty

----- Original Message -----
From: "Vince Veselosky" <vi...@control-escape.com>
To: "Martin Moss" <ma...@btinternet.com>
Cc: <mo...@perl.apache.org>; <us...@httpd.apache.org>
Sent: Tuesday, April 08, 2003 3:50 PM
Subject: Re: Apache::Request question


> I had a similar experience recently when one of my handlers was getting
> executed twice for each request, with different request objects each
> time. It turned out that something (in my case mod_dir) was generating a
> subrequest (at the fixup stage), which creates a new Apache object.  I
> suspect that the unexpected subrequest is also biting you.
>
> Perhaps you can test using $r->is_main to see if the request is or is
> not a subrequest. If it is, you can use $r->prev or $r->main to get at
> the originating request, if that is what you need. (It's a shame that
> $r->main returns undef instead of a reference to itself in the main
> request, it would be useful to always be able to get ahold of the main
> request that way instead of all the testing.)
>
> Hope that helps you!
> -Vince Veselosky
> http://ice.control-escape.com
>
>
> Martin Moss wrote:
>
> >All,
> >
> >
> >During one complete cycle of a Request, e.g.
> >authen handler -> authz handler -> method handler
> >
> >should/does Apache give the same 'Apache' Object to my code.
> >e.g. If I dump the Apache object at the start of each 'handler' should I
> >expect to see the following identical line?:-
> >$VAR1 = bless( do{\(my $o = 145577148)}, 'Apache' );
> >
> ><incidentally can anybody tell me what the $o refers to?>
> >
> >The reason I ask is, that I don't see this behaviour. The first two
handlers
> >(authen and authz) have the same one, but I get a new Apache Object for
my
> >method handler.
> >This is causing me grief because it means that when I do an
> >Apache::request->instance($r) I get a NEW Apache::Request object not  the
> >same INSTANCE I was getting for the first two phases, and indeed
expecting
> >to get for each phase of the request cycle (I editted the
> >Apache::Request->instance subroutine to print a warning whenever it can't
> >find the previous object in the pnotes, and it is definitely creating a
new
> >object).
> >Also, The Apache::Request Object that is created based upon the new
Apache
> >Object doesn't go out of scope until I stop apache. Which doesnt' seem
> >right.
> >
> >I am not calling the child_terminate anywhere and so I am confused as to
> >whether this is standard behaviour or not.
> >
> >Can anybody throw me a light on this one?
> >
> >Marty
> >
> >
> >
> >
> >
>
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Apache::Request question

Posted by Vince Veselosky <vi...@control-escape.com>.
I had a similar experience recently when one of my handlers was getting 
executed twice for each request, with different request objects each 
time. It turned out that something (in my case mod_dir) was generating a 
subrequest (at the fixup stage), which creates a new Apache object.  I 
suspect that the unexpected subrequest is also biting you.

Perhaps you can test using $r->is_main to see if the request is or is 
not a subrequest. If it is, you can use $r->prev or $r->main to get at 
the originating request, if that is what you need. (It's a shame that 
$r->main returns undef instead of a reference to itself in the main 
request, it would be useful to always be able to get ahold of the main 
request that way instead of all the testing.)

Hope that helps you!
-Vince Veselosky
http://ice.control-escape.com


Martin Moss wrote:

>All,
>
>
>During one complete cycle of a Request, e.g.
>authen handler -> authz handler -> method handler
>
>should/does Apache give the same 'Apache' Object to my code.
>e.g. If I dump the Apache object at the start of each 'handler' should I
>expect to see the following identical line?:-
>$VAR1 = bless( do{\(my $o = 145577148)}, 'Apache' );
>
><incidentally can anybody tell me what the $o refers to?>
>
>The reason I ask is, that I don't see this behaviour. The first two handlers
>(authen and authz) have the same one, but I get a new Apache Object for my
>method handler.
>This is causing me grief because it means that when I do an
>Apache::request->instance($r) I get a NEW Apache::Request object not  the
>same INSTANCE I was getting for the first two phases, and indeed expecting
>to get for each phase of the request cycle (I editted the
>Apache::Request->instance subroutine to print a warning whenever it can't
>find the previous object in the pnotes, and it is definitely creating a new
>object).
>Also, The Apache::Request Object that is created based upon the new Apache
>Object doesn't go out of scope until I stop apache. Which doesnt' seem
>right.
>
>I am not calling the child_terminate anywhere and so I am confused as to
>whether this is standard behaviour or not.
>
>Can anybody throw me a light on this one?
>
>Marty
>
>
>
>  
>


Apache::Request question

Posted by Martin Moss <Ma...@btinternet.com>.
All,


During one complete cycle of a Request, e.g.
authen handler -> authz handler -> method handler

should/does Apache give the same 'Apache' Object to my code.
e.g. If I dump the Apache object at the start of each 'handler' should I
expect to see the following identical line?:-
$VAR1 = bless( do{\(my $o = 145577148)}, 'Apache' );

<incidentally can anybody tell me what the $o refers to?>

The reason I ask is, that I don't see this behaviour. The first two handlers
(authen and authz) have the same one, but I get a new Apache Object for my
method handler.
This is causing me grief because it means that when I do an
Apache::request->instance($r) I get a NEW Apache::Request object not  the
same INSTANCE I was getting for the first two phases, and indeed expecting
to get for each phase of the request cycle (I editted the
Apache::Request->instance subroutine to print a warning whenever it can't
find the previous object in the pnotes, and it is definitely creating a new
object).
Also, The Apache::Request Object that is created based upon the new Apache
Object doesn't go out of scope until I stop apache. Which doesnt' seem
right.

I am not calling the child_terminate anywhere and so I am confused as to
whether this is standard behaviour or not.

Can anybody throw me a light on this one?

Marty





[users@httpd] Apache::Request question

Posted by Martin Moss <Ma...@btinternet.com>.
All,


During one complete cycle of a Request, e.g.
authen handler -> authz handler -> method handler

should/does Apache give the same 'Apache' Object to my code.
e.g. If I dump the Apache object at the start of each 'handler' should I
expect to see the following identical line?:-
$VAR1 = bless( do{\(my $o = 145577148)}, 'Apache' );

<incidentally can anybody tell me what the $o refers to?>

The reason I ask is, that I don't see this behaviour. The first two handlers
(authen and authz) have the same one, but I get a new Apache Object for my
method handler.
This is causing me grief because it means that when I do an
Apache::request->instance($r) I get a NEW Apache::Request object not  the
same INSTANCE I was getting for the first two phases, and indeed expecting
to get for each phase of the request cycle (I editted the
Apache::Request->instance subroutine to print a warning whenever it can't
find the previous object in the pnotes, and it is definitely creating a new
object).
Also, The Apache::Request Object that is created based upon the new Apache
Object doesn't go out of scope until I stop apache. Which doesnt' seem
right.

I am not calling the child_terminate anywhere and so I am confused as to
whether this is standard behaviour or not.

Can anybody throw me a light on this one?

Marty





---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org