cvs commit: modperl-2.0/xs/APR/Table APR__Table.h

2002-07-09 Thread stas

stas2002/07/08 23:52:08

  Modified:xs/APR/Table APR__Table.h
  Log:
  apr_table_t is now an opaque type, use apr_table_elts() to get the array
  record
  
  Revision  ChangesPath
  1.8   +1 -1  modperl-2.0/xs/APR/Table/APR__Table.h
  
  Index: APR__Table.h
  ===
  RCS file: /home/cvs/modperl-2.0/xs/APR/Table/APR__Table.h,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- APR__Table.h  12 Nov 2001 22:14:36 -  1.7
  +++ APR__Table.h  9 Jul 2002 06:52:08 -   1.8
   -70,7 +70,7 
   char *filter_entry;
   STRLEN len;
   
  -tdata.filter = apr_hash_make(table-a.pool);
  +tdata.filter = apr_hash_make(apr_table_elts(table)-pool);
   
   while (MARK = SP) {
   filter_entry = SvPV(*MARK, len);
  
  
  



Re: nice mod_perl statistics to share

2002-07-09 Thread Mithun Bhattacharya


--- Stas Bekman [EMAIL PROTECTED] wrote:

  I don't understand why you think so.  If the '/' url is handled by
 a
  mod_perl enable server, then mod_perl will show up in the headers,
  proxy server or not.  Sure, there'll be some servers where you


But do we consider a proxy implementation as two mod_perl installations
or one ? I am sure other technologies would love to beat their chest
as two installations. If you throw in mod_backhand the figures go
haywire even more.

The company I work for utilizes multiple webservers sitting behind a
load balancer which in turn are talking to multiple application servers
who in turn are talking to couple of interface servers talking to third
party systems. If you hit our domain it would reflect just one
webserver 


Mithun

__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com



Re: modperl-2.0 make Error on Solaris

2002-07-09 Thread Stas Bekman


/users/webuser/src/modperl-2.0/xs/APR/Table/APR__Table.h:73: dereferencing
pointer to incomplete type
make[3]: *** [Table.o] Error 1

please either apply this patch or use the cvs version (which now 
contains this patch) and it will work.

Index: xs/APR/Table/APR__Table.h
===
RCS file: /home/cvs/modperl-2.0/xs/APR/Table/APR__Table.h,v
retrieving revision 1.7
diff -u -r1.7 APR__Table.h
--- xs/APR/Table/APR__Table.h   12 Nov 2001 22:14:36 -  1.7
+++ xs/APR/Table/APR__Table.h   9 Jul 2002 06:51:29 -
@@ -70,7 +70,7 @@
  char *filter_entry;
  STRLEN len;

-tdata.filter = apr_hash_make(table-a.pool);
+tdata.filter = apr_hash_make(apr_table_elts(table)-pool);

  while (MARK = SP) {
  filter_entry = SvPV(*MARK, len);


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: [win32] new perl/apache/mod_perl binary

2002-07-09 Thread Randy Kobes

On Tue, 9 Jul 2002, Ron Savage wrote:

 On Mon, 8 Jul 2002 00:24:30 -0500 (CDT), Randy Kobes wrote:
 Hi,
 I've placed an updated perl-5.6.1/Apache-1.3.26/mod_perl-1.27
 Win32 binary package, perl-win32-bin-0.8.exe (a self-extracting
 archive), in ftp://theoryx5.uwinnipeg.ca/pub/other/. This

 I cannot get this to start properly under WinNT.

 Symptoms:
 1)
 shellApache.exe -n Apache -k install
 2 lines of output appear:

 Installing the Apache service
 The Apache service has been installed successfully.

 and then a Windows error box, containing:
 The instruction at 0x... referenced memory at 0x The memory
 could not be 'read'.
 Nevertheless, Apache is installed, and can be uninstalled.
[ ... ]

Does it start OK, and give the server signature, if you just do
   C:\Apache Apache.exe
I think the problem might be in Embperl - try commenting out the
Embperl directives towards the bottom of httpd.conf and see if
that helps in starting the service. Neverthless, as you say,
things seem to work OK even with these errors on start-up.

best regards,
randy




Re: [win32] new perl/apache/mod_perl binary

2002-07-09 Thread Ron Savage

On Tue, 9 Jul 2002 02:25:41 -0500 (CDT), Randy Kobes wrote:

Randy

On Tue, 9 Jul 2002, Ron Savage wrote:

On Mon, 8 Jul 2002 00:24:30 -0500 (CDT), Randy Kobes wrote:
Hi,
I've placed an updated perl-5.6.1/Apache-1.3.26/mod_perl-1.27
Win32 binary package, perl-win32-bin-0.8.exe (a self-extracting
archive), in ftp://theoryx5.uwinnipeg.ca/pub/other/. This

I cannot get this to start properly under WinNT.

Symptoms:
1)
shellApache.exe -n Apache -k install
2 lines of output appear:

Installing the Apache service
The Apache service has been installed successfully.

and then a Windows error box, containing:
The instruction at 0x... referenced memory at 0x The memory
could not be 'read'.
Nevertheless, Apache is installed, and can be uninstalled.
[ ... ]

Does it start OK, and give the server signature, if you just do
C:\Apache Apache.exe

Yes.

I think the problem might be in Embperl - try commenting out the
Embperl directives towards the bottom of httpd.conf and see if
that helps in starting the service. Neverthless, as you say,
things seem to work OK even with these errors on start-up.

Yes, the problem is Embperl. Commenting it out (lines 1084 to 1096 of
httpd.conf) fixed things. Phew.

Thanx for your help.

--
Cheers
Ron Savage, [EMAIL PROTECTED] on 09/07/2002
http://savage.net.au/index.html





Re: nice mod_perl statistics to share

2002-07-09 Thread Ged Haywood

Hi there,

On Mon, 8 Jul 2002, Mithun Bhattacharya wrote:

 The company I work for utilizes multiple webservers sitting behind a
 load balancer which in turn are talking to multiple application servers
 who in turn are talking to couple of interface servers talking to third
 party systems. If you hit our domain it would reflect just one
 webserver 

I think most of the bucket shop holiday sites are set up like that.

73,
Ged.




Re: [OT] Better Linux server platform: Redhat or SuSe?

2002-07-09 Thread Ged Haywood

Hi all,

On Mon, 8 Jul 2002, Owen Scott Medd wrote:

 On Mon, 8 Jul 2002, Ganesan M wrote:
   Schoolmaster.net, 167,000 lines of Perl code, another 30,000 lines of C.
   
   Rich.
   
  How do you run 'C' code from Apache/mod_perl?
 
 Using the perl XS interface usually... that's how we access our text 
 analysis routines which are in C.

Or use Inline.pm if you don't want to get too deeply into it.

Or put your compiled code in the cgi-bin directory if you really can't
be bothered at all, but that's nasty.

73,
Ged.




mod-perl 1.99 installation on alpha

2002-07-09 Thread mark crowe (JIC)

Hi, I wonder if anyone can help. I'm trying to install mod-perl 1.99.04 on an alpha 
running OSF1 v4.0d with apache 2.0.39 and perl 5.6.1. I'm consistently getting the 
same error when I try 'make':-

ld:
Invalid flag usage: Wl,-rpath,/usr/local/lib/perl5/5.6.1/alpha-dec_osf/CORE, 
-Wx,-option must appear after -_SYSTYPE_SVR4 
ld: Usage: ld [options] file [...]
make[1]: *** [mod_perl.so] Error 1
make[1]: Leaving directory `/usr/local/src/mod_perl-1.99_04/src/modules/perl'
make: *** [modperl_lib] Error 2

This subject came up on the list about 18 months ago, but with mod-perl 1.26 and 
apache 1.3; the solution then was to build a static mod-perl and use perl 5.005. 
However according to the documentation, static builds are not yet supported in 
mod-perl 1.99, and I'm not going to go back to perl 5.005. 

If I manually edit the Makefiles to remove the Wl and change -rpath,/usr... to -rpath 
/usr..., things go further, but then die with another error:-

ld:
Object file format error in: tmp.a(ARFILENAMES): read_cur_obj_info: bad file magic 
number(0x6f6d)
make[3]: *** [../../../blib/arch/auto/ModPerl/Const/Const.so] Error 1
make[3]: Leaving directory `/usr/local/src/mod_perl-1.99_04/xs/ModPerl/Const'
make[2]: *** [subdirs] Error 2
make[2]: Leaving directory `/usr/local/src/mod_perl-1.99_04/xs/ModPerl'
make[1]: *** [subdirs] Error 2
make[1]: Leaving directory `/usr/local/src/mod_perl-1.99_04/xs'
make: *** [subdirs] Error 2

Is this related to the changes that I've made, or another problem? Has anyone managed 
to sucessfully do this installation on OSF 4.0d, and if so how please? 

TIA

Mark C
-- 

Dr Mark Crowe  John Innes Centre
   Norwich Research Park
Tel/Fax: +44 (1603) 450012 Colney   
mailto:[EMAIL PROTECTED]  Norwich
   NR4 7UH




Re: [OT] Better Linux server platform: Redhat or SuSe?

2002-07-09 Thread Ganesan M

From: Ged Haywood [EMAIL PROTECTED]
 Hi all,

 On Mon, 8 Jul 2002, Owen Scott Medd wrote:

   How do you run 'C' code from Apache/mod_perl?
 
  Using the perl XS interface usually... that's how we access our text
  analysis routines which are in C.

 Or use Inline.pm if you don't want to get too deeply into it.

 Or put your compiled code in the cgi-bin directory if you really can't
 be bothered at all, but that's nasty.

 Ged.

Ged must be kidding about throwing C binaries in CGI-BIN directory.
Anyway, I am trying to use some C programs in CGI-PERL/mod_perl/Apache.
I have tried Inline C.   I am not able to get the pointer working under
Inline C.

Owen, if you could give me any  location/documentation/tutorial  for how to
use
perlXS interface efficiently to access C progs, that will be great.

Here is my code.  Any help will be appreciated.

#!/usr/bin/perl -w
use Inline C  = DATA =
INC='-I/path/to//h -I/usr/include -I/usr/local/include',

   LIBS='-Lmy/libfiles1
  -L/my/libfiles2';

print(Test from Perl program);

myfunction();

__END__
__C__

#include myhfile.h
/
*-*/
void myfunction()
{
print(Test from C program);
  if (my-pointer_status != 'y')
  {
printf(My message here);
  }
return;
}






Re: [OT] Better Linux server platform: Redhat or SuSe?

2002-07-09 Thread Ganesan M

   How do you run 'C' code from Apache/mod_perl?

Oops.  I forgot to include the error message.

inlinetest_pl_c800.xs: In function `myfunction':
inlinetest_pl_c800.xs:24: request for member `pointer_status' in something
not a structure or union

G.




Re: [OT] Better Linux server platform: Redhat or SuSe?

2002-07-09 Thread Jean-Michel Hiver

 Owen, if you could give me any  location/documentation/tutorial  for
 how to use perlXS interface efficiently to access C progs, that will
 be great.

You might also want to take a look at SWIG (a search for 'SWIG' on
google will do as ususal), which looks quite interesting... it's a shame
that I have to get some sleep at night because I wish I had the chance
to take a long look at this neato piece of code.

Cheers,
-- 
IT'S TIME FOR A DIFFERENT KIND OF WEB

  Jean-Michel Hiver - Software Director
  [EMAIL PROTECTED]
  +44 (0)114 255 8097

  VISIT HTTP://WWW.MKDOC.COM



Re: [mod_perl2] PerlChildInitHandlers with multiple (Win32) threads

2002-07-09 Thread Peter Rothermel

Thanks for the info, its exactly what I needed.

-pete

Stas Bekman wrote:

 Peter Rothermel wrote:
  Stas Bekman wrote:
 
 
 Peter Rothermel wrote:
 
 
 PerlChildInitHandler Apache::foo-loadkey
 
 Will the genkey method get execute at the
 initialization of each thread?
 
 Apache doesn't provide such a hook yet. May be in the future.
 
 child_init is for child process init, not threads.
 
http://perl.apache.org/release/docs/2.0/user/handlers/handlers.html#PerlChildInitHandler
 
 what are you trying to do?
 
 
  I'm encrypting/decrypting data within cookies that are holding session keys
  for authentication purposes.  I decrypt the session key within the cookie data,
  whenever I get an http request that has a cookie in the header.
 
  The RSA keys that I use for encrytion/decryption are regenerated when the Apache
  server is started.  My module has a load_key subroutine that I call before I do any
  encryption or decryption.  This returns a RSA object that is initialized with a 
global
  var that hold a 2048 bit RSA key.  If the global var is empty I generate a new key.
 
  The code works OK but I seem to be generating a 2048 bit key the first time
  that a user logs into my site. This key generation takes awhile. I would prefer
  generating the key when server/thread/interupter is started. I was hoping that
  a PerlClhildInitHandler could be used to call the gen_key subroutine to load
  the data into global var $private_key_string.

 There are a few possible approaches to this:

 1. for mod_perl to provide hooks for the following events:
 interp_init   (INIT)
 interp_destroy(DESTROY)
 so these can be run when a new interpreter is initialized after it has
 been cloned and when it's going to be destroyed.

 2. Using the thread interpreter pool mechanism for managing other items.
 But it's not clear whether this interface will ever have a Perl API,
 because threads::shared already does that.

 3. Build a pool based on threads::shared. Similar to what Doug has
 described in his overview:
 
http://perl.apache.org/release/docs/2.0/user/overview/overview.html#Thread_Item_Pool_API
 and which is now doable in pure Perl based on threads::shared. This is
 an interesting vacant module, but really you can just duplicate the
 concepts that Doug has described in the URL above. You want to be able
 to add new items, remove them, pop and push from the pool.

 should it be called Threads::TIPool as coined by Doug? (Thread Items Pool)

 Using this (currently not-existing) module you can create a pool of keys
 at the server startup and then use them whenever you need a key at run time.

 This is the same concept that the threaded version of Apache::DBI is
 going to use, and AFAIK is vacant as well. The challenge is to make it
 possible to have modules like Apache::DBI work transparently under
 various mpms, including the preforked and perchild mpms.

 __
 Stas BekmanJAm_pH -- Just Another mod_perl Hacker
 http://stason.org/ mod_perl Guide --- http://perl.apache.org
 mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
 http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: leaks with Apache::Request?

2002-07-09 Thread Dave Rolsky

On 8 Jul 2002, Joe Schaefer wrote:

 Write that like this, and I think your leak will
 disappear:

 my $r = Apache::Request-new( shift );

 AFAICT, Apache::Request::new is NOT leaking here, since the
 REFCNT of its returned object IS 1.  There might be some
 magic-related bug in perl that causes the assignment to bump
 $r's refcount to 2.  This MIGHT be circumventable with some better
 code in Request.xs, but I really don't know how to fix it.

 Until some perl guru enlightens us, as a personal rule I
 try hard to avoid expressions like

   $foo = make_something_out_of($foo);

 I realize that this isn't always possible, but it often/usually
 is.  Such advice would serve you well in this case; you could
 even get away with this

   my $r = shift;
   my $apr = Apache::Request-new($r);

 That's not going to leak, either.  At least I hope not :-)

I ended up using something like this and the leak went away.

It seems to me that this might actually be a Perl bug.

If I do this:

 my $x = shift;
 $x = make_something_from($x);

then it seems like the original $x should go out of scope when it is
assigned to, so its refcount should stay at 1.


-dave

/*==
www.urth.org
we await the New Sun
==*/




Re: leaks with Apache::Request?

2002-07-09 Thread Joe Schaefer

Dave Rolsky [EMAIL PROTECTED] writes:

 On 8 Jul 2002, Joe Schaefer wrote:

[...]

my $r = shift;
my $apr = Apache::Request-new($r);
 
  That's not going to leak, either.  At least I hope not :-)
 
 I ended up using something like this and the leak went away.
 
 It seems to me that this might actually be a Perl bug.

I doubt it's solely perl's fault.  The problem is that you 
have to be an internals wizard to write safe XS; otherwise
you just keep your fingers crossed.  :-)

Hopefully some generous soul will post a patch to Request.xs that
prevents this problem from ever arising.

 If I do this:
 
  my $x = shift;
  $x = make_something_from($x);
 
 then it seems like the original $x should go out of scope when it is
 assigned to, so its refcount should stay at 1.
   ^^

Right, it should stay at 1.  But all bets are off when
$x is has magic and make_something_from() is an XS sub :-).

-- 
Joe Schaefer



Re: leaks with Apache::Request?

2002-07-09 Thread darren chamberlain

* Joe Schaefer [EMAIL PROTECTED] [2002-07-09 12:47]:
 Dave Rolsky [EMAIL PROTECTED] writes:
  On 8 Jul 2002, Joe Schaefer wrote:
  If I do this:
  
   my $x = shift;
   $x = make_something_from($x);
  
  then it seems like the original $x should go out of scope when it is
  assigned to, so its refcount should stay at 1.
^^
 
 Right, it should stay at 1.  But all bets are off when
 $x is has magic and make_something_from() is an XS sub :-).

But the leak is not with $x, it's with what $_[0] is; $x is just a
reference to that, and the reassignment in the second line should
reassign $x, and decrement the ref count for what $x is pointing to at
that point.  So, it all depends on what make_something_from() does with
the $x's referent.

(darren)

-- 
Great minds discuss ideas.
Average minds discuss events.
Small minds discuss people.
-- Admiral Hyman G. Rickover



Trouble with DynaLoader in ActiveState bleedperl

2002-07-09 Thread Kent, Mr. John

Greetings,

modperl-2.0 installs fine on Solaris 2.7 using perl 5.6.1 with threads ON.

However when I tried:

For bleeding edge Perl:
  # (--delete to ensure a clean state)
  % rsync -acvz --delete --force \
rsync://ftp.linux.activestate.com/perl-current/ perl-current
  % cd perl-current
  % ./Configure -des -Dprefix=$HOME/bleedperl \
-Dusethreads -Doptimize='-g' -Dusedevel
  % make 


Got this running make  (Solaris 2.7)

Making DynaLoader (static)
Writing Makefile for DynaLoader
make[1]: Entering directory
`/users/webuser/src/httpd-2.0/perl-current/ext/DynaLoader'
make[1]: Leaving directory
`/users/webuser/src/httpd-2.0/perl-current/ext/DynaLoader'
make[1]: Entering directory
`/users/webuser/src/httpd-2.0/perl-current/ext/DynaLoader'
../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib
DynaLoader_pm.PL DynaLoader.pm
../../miniperl -I../../lib -I../../lib -I../../lib -I../../lib
XSLoader_pm.PL XSLoader.pm
cp XSLoader.pm ../../lib/XSLoader.pm
cp DynaLoader.pm ../../lib/DynaLoader.pm
AutoSplitting ../../lib/DynaLoader.pm (../../lib/auto/DynaLoader)
make[1]: Leaving directory
`/users/webuser/src/httpd-2.0/perl-current/ext/DynaLoader'
gcc -o perl  -L/usr/local/lib   perlmain.o lib/auto/DynaLoader/DynaLoader.a
libperl.a `cat ext.libs` -lsocket -lnsl -ldl -lm -lrt -lpthread -lc 
gcc: lib/auto/DynaLoader/DynaLoader.a: No such file or directory
make: *** [perl] Error 1

Perhaps someone from ActiveState will read this or this could be passed on
to them?

Thank you,

John Kent

Webmaster 
Naval Research Laboratory
Monterey CA
http://kauai.nlrmry.navy.mil/sat_products.html



RE: modperl-2.0 make Error on Solaris

2002-07-09 Thread Kent, Mr. John

Thank you Stas and Randy,

For replying.  Stas's patch indeed fixed the problem and modperl-2.0
installed
fine on Solaris 2.7

Thank you,

John Kent
Webmaster
Naval Research Laboratory
Monterey CA

-Original Message-
From: Stas Bekman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 09, 2002 7:56 AM
To: Randy Kobes
Cc: Kent, Mr. John; modperl (E-mail); [EMAIL PROTECTED]
Subject: Re: modperl-2.0 make Error on Solaris



/users/webuser/src/modperl-2.0/xs/APR/Table/APR__Table.h:73: dereferencing
pointer to incomplete type
make[3]: *** [Table.o] Error 1

please either apply this patch or use the cvs version (which now 
contains this patch) and it will work.

Index: xs/APR/Table/APR__Table.h
===
RCS file: /home/cvs/modperl-2.0/xs/APR/Table/APR__Table.h,v
retrieving revision 1.7
diff -u -r1.7 APR__Table.h
--- xs/APR/Table/APR__Table.h   12 Nov 2001 22:14:36 -  1.7
+++ xs/APR/Table/APR__Table.h   9 Jul 2002 06:51:29 -
@@ -70,7 +70,7 @@
  char *filter_entry;
  STRLEN len;

-tdata.filter = apr_hash_make(table-a.pool);
+tdata.filter = apr_hash_make(apr_table_elts(table)-pool);

  while (MARK = SP) {
  filter_entry = SvPV(*MARK, len);


__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: [win32] new perl/apache/mod_perl binary

2002-07-09 Thread Gerald Richter


Yes, the problem is Embperl. Commenting it out (lines 1084 to 1096 of
httpd.conf) fixed things. Phew.

I have also seen this problem with Embperl when installing Apache service.
It's not special to this binary version.

Since Apache gets always installed correctly, I never had taken the time to
track it down.

Gerald

-
Gerald Richterecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:   Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: [EMAIL PROTECTED] Voice:+49 6133 925131
WWW:http://www.ecos.de  Fax:  +49 6133 925152
-






Re: Trouble with DynaLoader in ActiveState bleedperl

2002-07-09 Thread Stas Bekman

Kent, Mr. John wrote:
 Greetings,
 
 modperl-2.0 installs fine on Solaris 2.7 using perl 5.6.1 with threads ON.
 
 However when I tried:
 
 For bleeding edge Perl:
   # (--delete to ensure a clean state)
   % rsync -acvz --delete --force \
 rsync://ftp.linux.activestate.com/perl-current/ perl-current
   % cd perl-current
   % ./Configure -des -Dprefix=$HOME/bleedperl \
 -Dusethreads -Doptimize='-g' -Dusedevel
   % make 

John, that's a question for perl5-porters --at-- perl.org.

make sure to use perl-current/utils/perlbug to report the bug.

BTW, ActiveState just hosts that rsync repository.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




RE: TransHandler called a second time after I've returned DECLINED

2002-07-09 Thread Randy Harmon

Rick, I hope you don't mind I've followed this up to the list.  Your reply
was *very* useful to me, and I hope others may benefit from it...since I
didn't find any archived information that was helpful and all.

 -Original Message-
 From: Rick Myers [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, July 03, 2002 7:00 PM

 Sorry for the late reply, but I don't read the list daily.
 (Erm, or even weekly it seems. :-)
 On Jun 25, 2002 at 08:26:37 -0700, Randy Harmon wrote:

Heh, the weeks do tend to fly by.  There goes another one now.

  I'm using a TransHandler, and having a problem where it sometimes gets
  called twice when I don't expect it
[...]
  On an example request for /exists/non-existent-dir/file.html,

[on the second, unexpected, TransHandler call]

  the uri() is screwed up as /file.html.  If the request is
  /exists/non/foo/file.html, then uri() is /foo/file.html on
  the second (unexpected) call to my TransHandler.

[Rick:]
 That's an example of Apache's simplistic approach to
 matching URL's to physical disk space. I don't recall if it
 was mod_perl or Apache that actually called the TransHandler
 twice, but I suspect the latter. Here's how I worked around
 it...

 PerlPostReadRequestHandler AlterTrans

 package AlterTrans

 sub handler {
 my ($r) = @_;
 return DECLINED if $blah_blah_blah;
 for (@{$r-get_handlers('PerlTransHandler')}) {
 /::handler$/ or $_ .= '::handler';
 my $rv = {\$_}($r);
 $rv != DECLINED and return $rv;
 }
 $r-set_handlers('PerlTransHandler', undef);
 OK;
 }

 Basically, what it does is calls your TransHandlers one at a
 time from the PostReadRequest phase.

 --rick

 Hmm.. maybe this is of interest?

 NAME
Apache::AlterTransChain - Alters the chaining behaviour of
[cut: rest of perldoc]

That is interesting.  I remain with trouble, in that my TransHandler relies
on things that apparently aren't available at the PostReadRequest phase -
specifically dir_config settings don't seem to be available when I use this
approach.

I was successful in using $r-set_handlers('PerlTransHandler', undef) in my
TransHandler, which apparently avoids the implicit subrequest that occurs
after I decline my TransHandler for a non-existent file like described
above.

There's still an interesting issue, where a subrequest that I *intend* to do
(while serving a site-branded error message) still has the original
filename - so I had to call $r-filename('/path/to/error_message.html')
before my subrequest would do the right thing.  But that problem is
independent of my above fix.

Thanks for the information, Rick.  Very helpful!

Randy




Growing Server Size modperl-2.0 on Solaris 2.7

2002-07-09 Thread Kent, Mr. John

Greetings,

Have noticed that modperl-2.0 servers running on Solaris 2.7 start 
off at 23M in size.  Five hours later they were at 38M.  If allowed to
continue
they could eventually use up all available RAM and crash the system.

Stopping then restarting returned them to 23M.

Has anyone else encountered this and is there a recommended solution
other than periodically stopping and starting?

Thank you,

John Kent
Webmaster
Naval Research Laboratory
Monterey CA

http://kauai.nrlmry.navy.mil/sat_products.html



RE: Growing Server Size modperl-2.0 on Solaris 2.7

2002-07-09 Thread stevea


Greetings,

Have noticed that modperl-2.0 servers running on Solaris 2.7 start
off at 23M in size.  Five hours later they were at 38M.  If allowed to
continue
they could eventually use up all available RAM and crash the system.

Stopping then restarting returned them to 23M.

Has anyone else encountered this and is there a recommended solution
other than periodically stopping and starting?

Hey John,
I don't see that on my Solaris 8 box (unless I throw some weak code at it).
BTW: There was a reason Sun created 8. ;)




Re: leaks with Apache::Request?

2002-07-09 Thread Joe Schaefer

darren chamberlain [EMAIL PROTECTED] writes:

 * Joe Schaefer [EMAIL PROTECTED] [2002-07-09 12:47]:
  Dave Rolsky [EMAIL PROTECTED] writes:
   On 8 Jul 2002, Joe Schaefer wrote:
   If I do this:
   
my $x = shift;
$x = make_something_from($x);
   
   then it seems like the original $x should go out of scope when it is
   assigned to, so its refcount should stay at 1.
 ^^
  
  Right, it should stay at 1.  But all bets are off when
  $x is has magic and make_something_from() is an XS sub :-).
 
 But the leak is not with $x, it's with what $_[0] is; $x is just a
 reference to that, and the reassignment in the second line should
 reassign $x, and decrement the ref count for what $x is pointing to at
 that point.  So, it all depends on what make_something_from() does with
 the $x's referent.

I don't think it's as simple as that-

THIS LEAKS:

  my $r = shift;
  $r = Apache::Request-new($r);

  my $r = shift;
  $r = Apache::Request-new($_) for $r;


DOES NOT LEAK:

  my $apr = Apache::Request-new(shift);

  my $r = shift;
  my $apr = $r; # $r and $apr have the same referent now right?
  $apr = Apache::Request-new($r);

  my $r = shift;
  my $apr = Apache::Request-new($r);

  my $r = shift;
  $r = Apache::Request-new($_) for map $_, $r;


Somehow the assignment operator MUST be involved in the leak here.
(You only get a leak when the *same* reference (*SV) is on both sides 
of the assignment).

-- 
Joe Schaefer



Re: Propogating Errors / E-Toys

2002-07-09 Thread Michael Schout

Perrin Harkins wrote:
 
 We've actually discussed this on the list.  It has to do with closures. 
  Matt gave a presentation about exception handling which covers it and 
 shows a workaround.  You can see it here:
 
 http://axkit.org/docs/presentations/tpc2001/

Sorry to chime in a little late on this.

But the Exceptions slides from the page above are either misleading, 
or I am misunderstainding just what exactly leaks in Error.

The slides above show a BAD example of Error.pm as:

sub handler {
 my $r = shift;
 my $count;

 try {
 # use $count in here...
 } catch Error with {
 };
}

However, the eToys article doesnt say that this is unsafe.  What the 
eToys article says is unsafe is code with nested try blocks like this:

my $count;
try {
...
try {
 # use $count in *here*
};
};

in other words, if I understand the eToys article correctly, the leaks 
only happen if I nest a try block inside another try block.  I have 
experimented some, and it appears to me that this is in fact the case 
($count doesnt get cleaned up if there is a nested try).  But as long as
I dont nest try blocks there doesnt appear to be a leak.

Are Matt's slides misleading on this point?  Or am I missing something here?

Mike




Re: Propogating Errors / E-Toys

2002-07-09 Thread Perrin Harkins

Michael Schout wrote:

 in other words, if I understand the eToys article correctly, the leaks 
 only happen if I nest a try block inside another try block.  I have 
 experimented some, and it appears to me that this is in fact the case 
 ($count doesnt get cleaned up if there is a nested try).  But as long as
 I dont nest try blocks there doesnt appear to be a leak.


You are correct, you won't get a leak from the code in Matt's example. 
 What you will get is an unexpected persistence of the value of the 
$count variable.  It will retain its value and not be reset when you 
enter the handler sub again.

There are other problems too, like return not doing what you would 
expect when used inside a try block (it only returns from the try block).

- Perrin




Re: Propogating Errors / E-Toys

2002-07-09 Thread Matt Sergeant

On Wed, 10 Jul 2002, Michael Schout wrote:

 Perrin Harkins wrote:
 
  We've actually discussed this on the list.  It has to do with closures.
   Matt gave a presentation about exception handling which covers it and
  shows a workaround.  You can see it here:
 
  http://axkit.org/docs/presentations/tpc2001/

 Sorry to chime in a little late on this.

 But the Exceptions slides from the page above are either misleading,
 or I am misunderstainding just what exactly leaks in Error.

I didn't say leaks in my slides. That's what you're misunderstanding. It
merely creates a closure. This *can* lead to leaks, but doesn't always.

I guess at some point I aught to pick up Error::Filter again. Damn that
hard drive crash (which lost the source code I had for a source filter
version of Error.pm, which didn't create closures).

-- 
!-- Matt --
:-Get a smart net/:-