You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Charlie Garrison <ga...@zeta.org.au> on 2003/04/30 18:57:43 UTC

Can't step into package with Apache::DB

Good morning,

I am having trouble using Apache::DB to step into a package called from a
registry script. My startup.pl has:

use Apache::DB ();
# Apache::DB->init;

Server won't start with second line (init) uncommented. And that may be my
problem. The httpd.conf file has:

<Location /bin>
    PerlFixupHandler Apache::DB
    SetHandler perl-script
    PerlHandler Apache::Registry
    Options ExecCGI
    Order allow,deny
    Allow from all
</Location>

Loading a script causes debugger to stop at beginning of registry script. I
can run various debugger commands (s,n,w,T, etc) while in the script. But
running step (s) just before MyPackage->new takes me into CGI module rather
than MyPackage. Stepping (through and) out of CGI methods, takes me back to
registry script. I never stop in MyPackage.

So, is the problem related to Apache::DB->init causing server startup to fail,
and if so can anyone suggest a fix. Otherwise can anyone suggest why I am
unable to step into my package.

Some quick testing with a simpler setup (commenting out all use MyPackage::*
statements in startup.pl) causes debugger to stop in MyPackage. I would
therefore assume the problem is due to not being able to call Apache::DB->init
from startup.pl.

Any suggestions would be appreciated.

Thanks,
Charlie
-- 
   Charlie Garrison    garrison@zeta.org.au
   PO Box 141, Windsor, NSW 2756, Australia 

Re: Can't step into package with Apache::DB

Posted by Stas Bekman <st...@stason.org>.
Charlie Garrison wrote:

> Nope, Perl 5.6.0.

99.9% is that is the reason for your problem. Upgrade to 5.6.1.

5.6.0 is *very* buggy.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Can't step into package with Apache::DB

Posted by Charlie Garrison <ga...@zeta.org.au>.
Good afternoon,

On 30/4/03 at 6:48 PM, Bruno Connelly <br...@whack.org> wrote:

>As others have mentioned, it'd be useful to see what's being printed
>to STDERR when Apache startup bails.

Sorry for not including that before; I actually missed it. The output is
simply:

Bus error

>Are you by chance using Perl 5.8?  

Nope, Perl 5.6.0.

And from perl-status ...

Embedded Perl version v5.6.0 for Apache/1.3.27 (Darwin) mod_perl/1.26
mod_ssl/2.8.13 OpenSSL/0.9.6i DAV/1.0.3 

Thanks,
Charlie
-- 
   Charlie Garrison    garrison@zeta.org.au
   PO Box 141, Windsor, NSW 2756, Australia 

Re: Can't step into package with Apache::DB

Posted by Bruno Connelly <br...@whack.org>.
  Charlie> use Apache::DB (); 
  Charlie> # Apache::DB->init; 
 
  Charlie> Server won't start with second line (init) uncommented. And 
  Charlie> that may be my problem. 
  [...] 
 
As others have mentioned, it'd be useful to see what's being printed
to STDERR when Apache startup bails.
 
Are you by chance using Perl 5.8?  I ask as Apache::DB won't work with 
Perl 5.8 without the following patch (I don't think this has ever made 
it to CPAN) and the situation you're running into sounds similar 
enough (but again, tough to tell without knowing the actual error 
message you're getting). 
 
For better or worse, the patch (again, irrelevant if not using 5.8):
                               
--- DB.pm       1999-10-11 16:50:33.000000000 -0700 
+++ DB.pm-5.8.patch 2003-04-17 19:57:29.000000000 -0700 
@@ -14,6 +14,7 @@              
 $Apache::Registry::MarkLine = 0; 
           
 sub init {                    
+    *DB::DB = sub {} unless DB->can("DB"); # hack to make this work with 5.8 
     if(init_debugger()) {     
        warn "[notice] Apache::DB initialized in child $$\n"; 
     } 

b.
--
/*  Bruno Connelly, <br...@whack.org>  */


Re: Can't step into package with Apache::DB

Posted by Charlie Garrison <ga...@zeta.org.au>.
Good morning,

On 1/5/03 at 11:22 AM, Stas Bekman <st...@stason.org> wrote:

>>>Can you explain what you mean by "the server won't start" when you
>>>call Apache::DB->init() from your startup.pl?  You are running in -X
>>>mode, right?
>> 
>> 
>> Yes, I am using the -X switch. And with Apache::DB->init() in startup.pl,
the
>> server fails to start and prints this message "httpd could not be started",
>> and nothing is printed to the error_log.
>
>Usually some error is printed when "httpd could not be started" is seen. When 
>-X is used error_log would be empty, the error goes to the console.

I don't often get embarrassed, but I guess we all have our moments. I had not
seen (noticed) the line on the console which simply says "Bus error". The
complete output is:

# /usr/sbin/httpd -X
[notice] Apache::DB initialized in child 688
Processing config directory: /private/etc/httpd/users
 Processing config file: /private/etc/httpd/users/charlie.conf
 Processing config file: /private/etc/httpd/users/cng.conf
Bus error


Note, in reality, I was using a modified apachectl script which was 'hiding'
the error. Calling the httpd directly made things a bit clearer.

Any suggestions?

Thanks,
Charlie
-- 
   Charlie Garrison    garrison@zeta.org.au
   PO Box 141, Windsor, NSW 2756, Australia 

Re: Can't step into package with Apache::DB

Posted by Stas Bekman <st...@stason.org>.
Charlie Garrison wrote:

>>Can you explain what you mean by "the server won't start" when you
>>call Apache::DB->init() from your startup.pl?  You are running in -X
>>mode, right?
> 
> 
> Yes, I am using the -X switch. And with Apache::DB->init() in startup.pl, the
> server fails to start and prints this message "httpd could not be started",
> and nothing is printed to the error_log.

Usually some error is printed when "httpd could not be started" is seen. When 
-X is used error_log would be empty, the error goes to the console.


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: Can't step into package with Apache::DB

Posted by Charlie Garrison <ga...@zeta.org.au>.
Good morning,

On 30/4/03 at 1:28 PM, Perrin Harkins <pe...@elem.com> wrote:

>> Loading a script causes debugger to stop at beginning of registry script. I
>> can run various debugger commands (s,n,w,T, etc) while in the script. But
>> running step (s) just before MyPackage->new takes me into CGI module rather
>> than MyPackage. Stepping (through and) out of CGI methods, takes me back to
>> registry script. I never stop in MyPackage.
>
>That's because you compiled MyPackage before you started the debugger.
> It has no debugging symbols in it.

I thought that might be the case. I'm still wrapping my head around using the
debugger.

>>Some quick testing with a simpler setup (commenting out all use
>>MyPackage::* statements in startup.pl) causes debugger to stop in
>>MyPackage.
>
>Well, that's one way that works.  That delays the compilation of these
>things until after your PerlFixupHandler calls Apache::DB->init().

That's what I thought but wasn't sure. Thanks for clearing it up.

>Can you explain what you mean by "the server won't start" when you
>call Apache::DB->init() from your startup.pl?  You are running in -X
>mode, right?

Yes, I am using the -X switch. And with Apache::DB->init() in startup.pl, the
server fails to start and prints this message "httpd could not be started",
and nothing is printed to the error_log.

I could try debugging the apache process itself, but that is getting way out
of my comfort zone and was hoping to get an answer here instead.

Thanks for your reply. Do you have any suggestions?


Charlie
-- 
   Charlie Garrison    garrison@zeta.org.au
   PO Box 141, Windsor, NSW 2756, Australia 

Re: Can't step into package with Apache::DB

Posted by Perrin Harkins <pe...@elem.com>.
On Wednesday 30 April 2003 12:57 pm, Charlie Garrison wrote:
> Loading a script causes debugger to stop at beginning of registry script. I
> can run various debugger commands (s,n,w,T, etc) while in the script. But
> running step (s) just before MyPackage->new takes me into CGI module rather
> than MyPackage. Stepping (through and) out of CGI methods, takes me back to
> registry script. I never stop in MyPackage.

That's because you compiled MyPackage before you started the debugger.  It has 
no debugging symbols in it.

> Some quick testing with a simpler setup (commenting out all use
> MyPackage::* statements in startup.pl) causes debugger to stop in
> MyPackage.

Well, that's one way that works.  That delays the compilation of these things 
until after your PerlFixupHandler calls Apache::DB->init().

Can you explain what you mean by "the server won't start" when you call 
Apache::DB->init() from your startup.pl?  You are running in -X mode, right?

- Perrin