You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Kulasekaran, Raja" <Ra...@netapp.com> on 2009/09/12 04:42:24 UTC

FW: Apache::DBI Failed due to +GlobalRequest

Hi, 

 

I have  configured with my apache 2.2 with Mod perl.  When I tried to
use Apache::DBI for  persistent Database connection, It shows the below
error 

 

[Thu Sep 10 14:39:30 2009] [error] Global $r object is not available.
Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at
/var/www/audashboard/exec/startup.pl line 24.\nCompilation failed in
require at (eval 5) line 1.\n

 [Thu Sep 10 14:40:05 2009] [warn] Init: Session Cache is not configured
[hint: SSLSessionCache]

[Thu Sep 10 14:40:05 2009] [error] Global symbol "$r" requires explicit
package name at startup.pl line 24.\nCompilation failed in require at
(eval 5) line 1.\n

 

I have re-installed CGI 3.45 and enable the PerlOptions in my virtual
host. But still it is not working for me .

 

Can you please suggest me on this ? 

 

Raja 

 

 

 


Re: FW: Apache::DBI Failed due to +GlobalRequest

Posted by Adam Prime <ad...@utoronto.ca>.
Kulasekaran, Raja wrote:
> Hi,
> 
> Great. I guess this might solve the problem.
> 
> I had found in one of the forum stating that  we can write a handler
> which generates the “$r” global object  before initiate the Apache::DBI
>  connection .  Is that possible ? .
> 
> Otherwise, Shall I  install Apache::DBI 1.06 instead of Apache::DBI 1.07 ?

I would recommend running 1.06 until a new version is pushed with this
issue fixed.

Adam

RE: FW: Apache::DBI Failed due to +GlobalRequest

Posted by "Kulasekaran, Raja" <Ra...@netapp.com>.
Hi,

 

Persistent DB  connection working fine with Apache::DBI . 

 

But When I try to benchmark the performance with  apache  "ab" command  ( ab -n 100 -c 3  hostname ) ,  It failed with  Segmentation fault (11) . 

 

I have enabled the DBI trace and it shows like 

 

" DBD::Oracle::st execute failed: ORA-01002: fetch out of sequence (DBD ERROR: OCIStmtExecute) [for Statement "

 

Any suggestion on this ? 

 

Thanks,

Raja 

 

From: Brad Van Sickle [mailto:bvs7085@gmail.com] 
Sent: Saturday, September 12, 2009 9:29 PM
To: Kulasekaran, Raja
Cc: mod_perl list
Subject: Re: FW: Apache::DBI Failed due to +GlobalRequest

 

That simple modification of the code I gave you should solve your problem in 2 minutes. No need to downgrade. 

Kulasekaran, Raja wrote: 

Hi,

 

Great. I guess this might solve the problem. 

 

I had found in one of the forum stating that  we can write a handler which generates the "$r" global object  before initiate the Apache::DBI  connection .  Is that possible ? .

 

Otherwise, Shall I  install Apache::DBI 1.06 instead of Apache::DBI 1.07 ? 

 

Thanks,

Raja 

 

From: Brad Van Sickle [mailto:bvs7085@gmail.com] 
Sent: Saturday, September 12, 2009 7:54 PM
To: mod_perl list
Cc: Kulasekaran, Raja
Subject: Re: FW: Apache::DBI Failed due to +GlobalRequest

 

I've run into this before.   It's a bug in v1.07 of Apache::DBI

Open up the Apache/DBI.pm source file (on one of my test systems it's installed in /usr/lib/perl5/site_perl/5.8.8/Apache/DBI.pm) aind the following block of code: 
   if (!$Rollback{$Idx}) {
        my $r;
        if (MP2) {
                $r = Apache2::RequestUtil->request;
                }
        elsif (Apache->can('push_handlers')) {
            $r = 'Apache';
        }

The problem with this is that if you're calling this from startup.pl you're not actually in a request at that point  (as someone already mentioned) so without the eval there the script dies. 

Fix it by wrapping the "$r = Apache2::RequestUtil->request;" part in an eval so it looks like this: eval { $r = Apache2::RequestUtil->request;}








André Warnier wrote: 

Kulasekaran, Raja wrote: 




Hi, 

Thanks for your mail. I did tried. It's not working . 

Yes, I am sorry.  I did not look close enough at the following error : 

[Thu Sep 10 14:39:30 2009] [error] Global $r object is not available. 
Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at 
/var/www/audashboard/exec/startup.pl line 24.\nCompilation failed in 
require at (eval 5) line 1.\n 

In a mod_perl *request* handler, the first argument 
(my $r = shift;) 
is usually a pointer to the current Request object. 

But in your startup script (startup.pl), that is not the case, because when that script is run, there is no request yet. 
I don't know what you are trying to do with $r in that startup script, but something is wrong and maybe the error message above is misleading. 
(I mean that it may have nothing to do with GlobalRequest at that stage.) 


RE: FW: Apache::DBI Failed due to +GlobalRequest

Posted by "Kulasekaran, Raja" <Ra...@netapp.com>.
Hi,

 

Great. I guess this might solve the problem. 

 

I had found in one of the forum stating that  we can write a handler which generates the "$r" global object  before initiate the Apache::DBI  connection .  Is that possible ? .

 

Otherwise, Shall I  install Apache::DBI 1.06 instead of Apache::DBI 1.07 ? 

 

Thanks,

Raja 

 

From: Brad Van Sickle [mailto:bvs7085@gmail.com] 
Sent: Saturday, September 12, 2009 7:54 PM
To: mod_perl list
Cc: Kulasekaran, Raja
Subject: Re: FW: Apache::DBI Failed due to +GlobalRequest

 

I've run into this before.   It's a bug in v1.07 of Apache::DBI

Open up the Apache/DBI.pm source file (on one of my test systems it's installed in /usr/lib/perl5/site_perl/5.8.8/Apache/DBI.pm) aind the following block of code: 
   if (!$Rollback{$Idx}) {
        my $r;
        if (MP2) {
                $r = Apache2::RequestUtil->request;
                }
        elsif (Apache->can('push_handlers')) {
            $r = 'Apache';
        }

The problem with this is that if you're calling this from startup.pl you're not actually in a request at that point  (as someone already mentioned) so without the eval there the script dies. 

Fix it by wrapping the "$r = Apache2::RequestUtil->request;" part in an eval so it looks like this: eval { $r = Apache2::RequestUtil->request;}








André Warnier wrote: 

Kulasekaran, Raja wrote: 



Hi, 

Thanks for your mail. I did tried. It's not working . 

Yes, I am sorry.  I did not look close enough at the following error : 

[Thu Sep 10 14:39:30 2009] [error] Global $r object is not available. 
Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at 
/var/www/audashboard/exec/startup.pl line 24.\nCompilation failed in 
require at (eval 5) line 1.\n 

In a mod_perl *request* handler, the first argument 
(my $r = shift;) 
is usually a pointer to the current Request object. 

But in your startup script (startup.pl), that is not the case, because when that script is run, there is no request yet. 
I don't know what you are trying to do with $r in that startup script, but something is wrong and maybe the error message above is misleading. 
(I mean that it may have nothing to do with GlobalRequest at that stage.) 


Re: FW: Apache::DBI Failed due to +GlobalRequest

Posted by Brad Van Sickle <bv...@gmail.com>.
I've run into this before.   It's a bug in v1.07 of Apache::DBI

Open up the Apache/DBI.pm source file (on one of my test systems it's 
installed in /usr/lib/perl5/site_perl/5.8.8/Apache/DBI.pm) aind the 
following block of code:
/   if (!$Rollback{$Idx}) {
        my $r;
        if (MP2) {
                $r = Apache2::RequestUtil->request;
                }
        elsif (Apache->can('push_handlers')) {
            $r = 'Apache';
        }
/
The problem with this is that if you're calling this from startup.pl 
you're not actually in a request at that point  (as someone already 
mentioned) so without the eval there the script dies.

Fix it by wrapping the "/$r = Apache2::RequestUtil->request;/" part in 
an eval so it looks like this: /eval { $r = Apache2::RequestUtil->request;}

/






André Warnier wrote:
> Kulasekaran, Raja wrote:
>> Hi,
>>
>> Thanks for your mail. I did tried. It's not working .
>>
> Yes, I am sorry.  I did not look close enough at the following error :
>
> [Thu Sep 10 14:39:30 2009] [error] Global $r object is not available.
> Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at
> /var/www/audashboard/exec/startup.pl line 24.\nCompilation failed in
> require at (eval 5) line 1.\n
>
> In a mod_perl *request* handler, the first argument
> (my $r = shift;)
> is usually a pointer to the current Request object.
>
> But in your startup script (startup.pl), that is not the case, because 
> when that script is run, there is no request yet.
> I don't know what you are trying to do with $r in that startup script, 
> but something is wrong and maybe the error message above is misleading.
> (I mean that it may have nothing to do with GlobalRequest at that stage.)

Re: FW: Apache::DBI Failed due to +GlobalRequest

Posted by André Warnier <aw...@ice-sa.com>.
Kulasekaran, Raja wrote:
> Hi,
> 
> Thanks for your mail. I did tried. It's not working .
> 
Yes, I am sorry.  I did not look close enough at the following error :

[Thu Sep 10 14:39:30 2009] [error] Global $r object is not available.
Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at
/var/www/audashboard/exec/startup.pl line 24.\nCompilation failed in
require at (eval 5) line 1.\n

In a mod_perl *request* handler, the first argument
(my $r = shift;)
is usually a pointer to the current Request object.

But in your startup script (startup.pl), that is not the case, because 
when that script is run, there is no request yet.
I don't know what you are trying to do with $r in that startup script, 
but something is wrong and maybe the error message above is misleading.
(I mean that it may have nothing to do with GlobalRequest at that stage.)

RE: FW: Apache::DBI Failed due to +GlobalRequest

Posted by "Kulasekaran, Raja" <Ra...@netapp.com>.
Hi,

Thanks for your mail. I did tried. It's not working .

Below is my virtual host detail 

<VirtualHost xxxx>
    ServerAdmin kraja@netapp.com
    DocumentRoot "XXXX"
    ServerName XXXX
    ErrorLog XXXX
    CustomLog XXXX common

    SetEnv PERL5LIB " XXXX/lib/"
    setenv ORACLE_USERID XXXX
    setenv ORACLE_HOME XXXX
    setenv LD_LIBRARY_PATH XXXX
    setenv ORACLE_SID XXXX
    setenv ORA_NLS10 XXXX

    PerlModule Apache::DBI
    PerlPostConfigRequire XXXX/startup.pl
    PerlOptions +GlobalRequest

<Directory "XXXX">
   AddHandler server-parsed .shtml .html
   AddOutputFilter INCLUDES .cgi .shtml .pl .html 
   AllowOverride None
    Options Indexes FollowSymLinks MultiViews +ExecCGI Includes
    Allow from all,deny
</Directory>
</VirtualHost>

- Raja 


-----Original Message-----
From: André Warnier [mailto:aw@ice-sa.com] 
Sent: Saturday, September 12, 2009 3:43 PM
To: Kulasekaran, Raja
Subject: Re: FW: Apache::DBI Failed due to +GlobalRequest

Kulasekaran, Raja wrote:
> Hi, 
> 
>  
> 
> I have  configured with my apache 2.2 with Mod perl.  When I tried to
> use Apache::DBI for  persistent Database connection, It shows the below
> error 
> 
>  
> 
> [Thu Sep 10 14:39:30 2009] [error] Global $r object is not available.
> Set:\n\tPerlOptions +GlobalRequest\nin httpd.conf at
> /var/www/audashboard/exec/startup.pl line 24.\nCompilation failed in
> require at (eval 5) line 1.\n
> 
>  [Thu Sep 10 14:40:05 2009] [warn] Init: Session Cache is not configured
> [hint: SSLSessionCache]
> 
> [Thu Sep 10 14:40:05 2009] [error] Global symbol "$r" requires explicit
> package name at startup.pl line 24.\nCompilation failed in require at
> (eval 5) line 1.\n
> 
>  
> 
> I have re-installed CGI 3.45 and enable the PerlOptions in my virtual
> host. But still it is not working for me .
> 
What happens if you set that option *outside* of any VirtualHost 
section, like in the main config. file ?