You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stas Bekman <st...@stason.org> on 2003/10/20 20:12:25 UTC

Re: Apache::Scoreboard trouble on Mac OS X

Ray Zimmerman wrote:
> I have perl-5.8.0 installed on Mac OS X 10.2.8 in /usr/local with no 
> problems.
> 
> The other day I installed Apache::Scoreboard but when I try running ...
> 
> #!/usr/bin/perl -w
> use strict;
> use Apache::Scoreboard;
> 1;
> 
> ... I get ...
> 
> dyld: perl Undefined symbols:
> _ap_rwrite
> _ap_send_http_header
> _ap_set_content_length
> _sv2request_rec
> Trace/BPT trap

Are you sure you are trying it under running mod_perl, and not mod_cgi? If 
yes, check that the above symbols are defined in the httpd (and mod_perl 
shared object, if it wasn't built as static), e.g. on my machine that would be:

nm /home/httpd/httpd_perl/bin/httpd | grep ap_send_http_header
080e3dfb T ap_send_http_header

etc, for the rest of the symbols reported missing.

BTW, I suppose blib/arch/auto/Apache/Scoreboard/Scoreboard.bundle is the 
shared object created on Mac OS X? If you have ldd, can you run:
ldd blib/arch/auto/Apache/Scoreboard/Scoreboard.bundle

__________________________________________________________________
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: Apache::Scoreboard trouble on Mac OS X

Posted by Stas Bekman <st...@stason.org>.
Ray Zimmerman wrote:
> At 11:55 AM -0700 10/20/03, Stas Bekman wrote:
> 
>> Ray Zimmerman wrote:
>>
>>> At 11:12 AM -0700 10/20/03, Stas Bekman wrote:
>>>
>>>> Are you sure you are trying it under running mod_perl, and not mod_cgi?
>>>
>>>
>>>
>>> No ... I haven't gotten that far ... I'm just trying to run a script 
>>> from the command line. The following works just fine on my Linux box ...
>>
>>
>> Hehe, that's your problem. Apache:: modules don't work from the 
>> command line, since the modperl/apache runtime environment is not loaded.
> 
> 
> I'm afraid I don't have the expertise to debug the byte order issues, 
> etc. but I wanted to be sure that I'm trying to do something reasonable. 
> Your comments seem to imply that Apache::Scoreboard is only meant to be 
> used within a mod_perl environment, but the POD docs say ...
> 
> SYNOPSIS
>          use Apache::Scoreboard ();
> 
>          #inside httpd
>          my $image = Apache::Scoreboard->image;
> 
>          #outside httpd
>          my $image = 
> Apache::Scoreboard->fetch("http://localhost/scoreboard");
> 
> ... which to me indicates that it is intended to work from the 
> command-line as well, like the little script I posted.

I think 99.9% of Apache:: modules won't work outside mod_perl. When you see 
Apache:: think mod_perl. Remember your original report with missing symbols:

The first three:
_ap_rwrite
_ap_send_http_header
_ap_set_content_length

live in Apache, so you can't run it without Apache.

_sv2request_rec

This one comes from mod_perl, so you need mod_perl.

> Just trying to sort out whether this is a bug or whether I'm expecting 
> it do something it was not intended to do.

The latter. Though it's quite possible that it can be arranged for it not to 
require mod_perl.

> BTW, who maintains Apache::Scoreboard ... Doug?

Doug maintains the 1.x generation. I maintain the 2.x generation. I'll make a 
first release soon.

__________________________________________________________________
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: Apache::Scoreboard trouble on Mac OS X

Posted by Ray Zimmerman <rz...@cornell.edu>.
At 11:55 AM -0700 10/20/03, Stas Bekman wrote:
>Ray Zimmerman wrote:
>>At 11:12 AM -0700 10/20/03, Stas Bekman wrote:
>>>Are you sure you are trying it under running mod_perl, and not mod_cgi?
>>
>>
>>No ... I haven't gotten that far ... I'm just trying to run a 
>>script from the command line. The following works just fine on my 
>>Linux box ...
>
>Hehe, that's your problem. Apache:: modules don't work from the 
>command line, since the modperl/apache runtime environment is not 
>loaded.

I'm afraid I don't have the expertise to debug the byte order issues, 
etc. but I wanted to be sure that I'm trying to do something 
reasonable. Your comments seem to imply that Apache::Scoreboard is 
only meant to be used within a mod_perl environment, but the POD docs 
say ...

SYNOPSIS
          use Apache::Scoreboard ();

          #inside httpd
          my $image = Apache::Scoreboard->image;

          #outside httpd
          my $image = Apache::Scoreboard->fetch("http://localhost/scoreboard");

... which to me indicates that it is intended to work from the 
command-line as well, like the little script I posted.

Just trying to sort out whether this is a bug or whether I'm 
expecting it do something it was not intended to do.

BTW, who maintains Apache::Scoreboard ... Doug?

-- 
  Ray Zimmerman  / e-mail: rz10@cornell.edu / 428-B Phillips Hall
   Sr Research  /   phone: (607) 255-9645  /  Cornell University
    Associate  /      FAX: (815) 377-3932 /   Ithaca, NY  14853

Re: Apache::Scoreboard trouble on Mac OS X

Posted by Stas Bekman <st...@stason.org>.
Ray Zimmerman wrote:
> At 12:03 PM -0700 10/20/03, Stas Bekman wrote:
> 
>> Stas Bekman wrote:
>> [...]
>>
>>>> No ... I haven't gotten that far ... I'm just trying to run a script 
>>>> from the command line. The following works just fine on my Linux box 
>>>> ...
>>>
>>>
>>>
>>> Hehe, that's your problem. Apache:: modules don't work from the 
>>> command line, since the modperl/apache runtime environment is not 
>>> loaded. perhaps Apache::Scoreboard should be patched to require 
>>> 'mod_perl', I'll look into adding it.
>>
>>
>> Try with this patch:
> 
> 
> <snip>
> 
> It still gives me the undefined symbols when running from the command 
> line. 

Right, please disregard my patch then. For some reason:

   % perl -Mmod_perl -le1

doesn't fail ;) I thought it will ;)

The patch will still be needed to prevent from people trying to run it from 
mod_perl 2.0.

> However, I can start my server with Apache::Scoreboard installed 
> and if I modify the little script on my Linux box to fetch the 
> scoreboard image from my MacOSX machine, I get ...
> 
> -1608318976 : _ 167772160 7214202.880000 GET 
> /admin/phpMyAdmin-2.5.4-rc1/left.php?lang=en-iso-8859-1&ser
> -1574764544 : K 50331648 671088.640000 GET /icons/blank.gif HTTP/1.1
> -1557987328 : K 33554432 0.000000 GET /icons/back.gif HTTP/1.1
> -1541210112 : _ 100663296 5536481.280000 GET /scoreboard HTTP/1.1
> -1524432896 : K 50331648 1342177.280000 GET /icons/folder.gif HTTP/1.1
> -1507655680 : W 33554432 4697620.480000 GET /scoreboard HTTP/1.1
> -1490878464 : _ 33554432 167772.160000 GET 
> /admin/phpMyAdmin-2.5.4-rc1/images/pma_logo.png HTTP/1.1
> 
> ... which is a response, but it still looks like it's got issues. When I 
> fetch from the Linux box it looks like below. Guess the image isn't 
> compatible across platforms or something?
> 
>  13802 : _      0 0.000000
>  13803 : _      0 0.000000
>  13804 : _     44 0.230000 GET /matpower/ HTTP/1.1
>  13805 : _    132 1.150000 GET /robots.txt HTTP/1.1
>  13806 : _    129 2.410000 GET /powerweb/papers/HICSS97.pdf HTTP/1.1
>  19153 : _     74 2.830000 GET /powerweb/ HTTP/1.1
>  19154 : _     72 0.340000 GET /tcc/pix/TCCalculator.gif HTTP/1.0
>  19155 : _    107 0.750000 GET /default.css HTTP/1.1
>  19184 : _     63 2.610000 GET /matpower HTTP/1.0
>  19474 : W    113 0.440000 GET /scoreboard HTTP/1.1
>  19544 : .      0 0.000000
>  19545 : .      0 0.000000
>  19546 : .      0 0.000000

apxs/send.c converts the scoreboard image into the network order bytes before 
sending it out. I'd suggest to look at that code in order to debug it.

__________________________________________________________________
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: Apache::Scoreboard trouble on Mac OS X

Posted by Ray Zimmerman <rz...@cornell.edu>.
At 12:03 PM -0700 10/20/03, Stas Bekman wrote:
>Stas Bekman wrote:
>[...]
>>>No ... I haven't gotten that far ... I'm just trying to run a 
>>>script from the command line. The following works just fine on my 
>>>Linux box ...
>>
>>
>>Hehe, that's your problem. Apache:: modules don't work from the 
>>command line, since the modperl/apache runtime environment is not 
>>loaded. perhaps Apache::Scoreboard should be patched to require 
>>'mod_perl', I'll look into adding it.
>
>Try with this patch:

<snip>

It still gives me the undefined symbols when running from the command 
line. However, I can start my server with Apache::Scoreboard 
installed and if I modify the little script on my Linux box to fetch 
the scoreboard image from my MacOSX machine, I get ...

-1608318976 : _ 167772160 7214202.880000 GET 
/admin/phpMyAdmin-2.5.4-rc1/left.php?lang=en-iso-8859-1&ser
-1574764544 : K 50331648 671088.640000 GET /icons/blank.gif HTTP/1.1
-1557987328 : K 33554432 0.000000 GET /icons/back.gif HTTP/1.1
-1541210112 : _ 100663296 5536481.280000 GET /scoreboard HTTP/1.1
-1524432896 : K 50331648 1342177.280000 GET /icons/folder.gif HTTP/1.1
-1507655680 : W 33554432 4697620.480000 GET /scoreboard HTTP/1.1
-1490878464 : _ 33554432 167772.160000 GET 
/admin/phpMyAdmin-2.5.4-rc1/images/pma_logo.png HTTP/1.1

... which is a response, but it still looks like it's got issues. 
When I fetch from the Linux box it looks like below. Guess the image 
isn't compatible across platforms or something?

  13802 : _      0 0.000000
  13803 : _      0 0.000000
  13804 : _     44 0.230000 GET /matpower/ HTTP/1.1
  13805 : _    132 1.150000 GET /robots.txt HTTP/1.1
  13806 : _    129 2.410000 GET /powerweb/papers/HICSS97.pdf HTTP/1.1
  19153 : _     74 2.830000 GET /powerweb/ HTTP/1.1
  19154 : _     72 0.340000 GET /tcc/pix/TCCalculator.gif HTTP/1.0
  19155 : _    107 0.750000 GET /default.css HTTP/1.1
  19184 : _     63 2.610000 GET /matpower HTTP/1.0
  19474 : W    113 0.440000 GET /scoreboard HTTP/1.1
  19544 : .      0 0.000000
  19545 : .      0 0.000000
  19546 : .      0 0.000000


-- 
  Ray Zimmerman  / e-mail: rz10@cornell.edu / 428-B Phillips Hall
   Sr Research  /   phone: (607) 255-9645  /  Cornell University
    Associate  /      FAX: (815) 377-3932 /   Ithaca, NY  14853

Re: Apache::Scoreboard trouble on Mac OS X

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
[...]
>> No ... I haven't gotten that far ... I'm just trying to run a script 
>> from the command line. The following works just fine on my Linux box ...
> 
> 
> Hehe, that's your problem. Apache:: modules don't work from the command 
> line, since the modperl/apache runtime environment is not loaded. 
> perhaps Apache::Scoreboard should be patched to require 'mod_perl', I'll 
> look into adding it.

Try with this patch:

Index: Changes
===================================================================
RCS file: /home/stas/cvs/modules/Apache-Scoreboard/Changes,v
retrieving revision 1.1
diff -u -r1.1 Changes
--- Changes     2003/10/20 19:58:24     1.1
+++ Changes     2003/10/20 20:01:37
@@ -1,3 +1,10 @@
+0.11 -
+
+require mod_perl from .pm files, so users trying to run it from the
+command line will get the right error message.
+
+require mod_perl 1.x
+
  0.10 - February 8, 2000

  fixed core dump in $image->servers($i), thanks to Stas for the spot
Index: Scoreboard.pm
===================================================================
RCS file: /home/stas/cvs/modules/Apache-Scoreboard/Scoreboard.pm,v
retrieving revision 1.1
diff -u -r1.1 Scoreboard.pm
--- Scoreboard.pm       2003/10/20 19:58:24     1.1
+++ Scoreboard.pm       2003/10/20 20:01:37
@@ -4,6 +4,11 @@
  use constant DEBUG => 0;

  BEGIN {
+    use mod_perl;
+    die "mod_perl < 2.0 is required" unless $mod_perl::VERSION < 1.99;
+}
+
+BEGIN {
      no strict;
      $VERSION = '0.10';
      @ISA = qw(DynaLoader);
Index: Dummy/DummyScoreboard.pm
===================================================================
RCS file: /home/stas/cvs/modules/Apache-Scoreboard/Dummy/DummyScoreboard.pm,v
retrieving revision 1.1
diff -u -r1.1 DummyScoreboard.pm
--- Dummy/DummyScoreboard.pm    2003/10/20 19:58:24     1.1
+++ Dummy/DummyScoreboard.pm    2003/10/20 20:01:37
@@ -3,6 +3,11 @@
  use strict;
  use DynaLoader ();

+BEGIN {
+    use mod_perl;
+    die "mod_perl < 2.0 is required" unless $mod_perl::VERSION < 1.99;
+}
+
  {
      no strict;
      $VERSION = '0.04';


__________________________________________________________________
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: Apache::Scoreboard trouble on Mac OS X

Posted by Stas Bekman <st...@stason.org>.
Ray Zimmerman wrote:
> At 11:12 AM -0700 10/20/03, Stas Bekman wrote:
> 
>> Ray Zimmerman wrote:
>>
>>> I have perl-5.8.0 installed on Mac OS X 10.2.8 in /usr/local with no 
>>> problems.
>>>
>>> The other day I installed Apache::Scoreboard but when I try running ...
>>>
>>> #!/usr/bin/perl -w
>>> use strict;
>>> use Apache::Scoreboard;
>>> 1;
>>>
>>> ... I get ...
>>>
>>> dyld: perl Undefined symbols:
>>> _ap_rwrite
>>> _ap_send_http_header
>>> _ap_set_content_length
>>> _sv2request_rec
>>> Trace/BPT trap
>>
>>
>> Are you sure you are trying it under running mod_perl, and not mod_cgi?
> 
> 
> No ... I haven't gotten that far ... I'm just trying to run a script 
> from the command line. The following works just fine on my Linux box ...

Hehe, that's your problem. Apache:: modules don't work from the command line, 
since the modperl/apache runtime environment is not loaded. perhaps 
Apache::Scoreboard should be patched to require 'mod_perl', I'll look into 
adding it.

The difference between MarxOS and Linux is that the former tries to resolve 
all symbols when you boot the shared object, whereas the latter uses the lazy 
resolving, resolving symbols as they are needed. In order to reproduce this on 
linux you need to run the script with env var PERL_DL_NONLAZY=1

__________________________________________________________________
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: Apache::Scoreboard trouble on Mac OS X

Posted by Ray Zimmerman <rz...@cornell.edu>.
At 11:12 AM -0700 10/20/03, Stas Bekman wrote:
>Ray Zimmerman wrote:
>>I have perl-5.8.0 installed on Mac OS X 10.2.8 in /usr/local with 
>>no problems.
>>
>>The other day I installed Apache::Scoreboard but when I try running ...
>>
>>#!/usr/bin/perl -w
>>use strict;
>>use Apache::Scoreboard;
>>1;
>>
>>... I get ...
>>
>>dyld: perl Undefined symbols:
>>_ap_rwrite
>>_ap_send_http_header
>>_ap_set_content_length
>>_sv2request_rec
>>Trace/BPT trap
>
>Are you sure you are trying it under running mod_perl, and not mod_cgi?

No ... I haven't gotten that far ... I'm just trying to run a script 
from the command line. The following works just fine on my Linux box 
...

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

use strict;

use Apache::Scoreboard;

my $image = Apache::Scoreboard->fetch("http://localhost/scoreboard");

for (my $parent = $image->parent; $parent; $parent = $parent->next) {
   my $pid = $parent->pid;
   my $server = $parent->server;
   printf("%6d : %s %6d %8f %s\n", $pid, $server->status,
          $server->access_count, scalar $server->times, $server->request);
}

1;
----------------------

... but on my OSX machine even ...

% perl -MApache::Scoreboard -e ''

... give me the undefined symbols.

-- 
  Ray Zimmerman  / e-mail: rz10@cornell.edu / 428-B Phillips Hall
   Sr Research  /   phone: (607) 255-9645  /  Cornell University
    Associate  /      FAX: (815) 377-3932 /   Ithaca, NY  14853