subprocess_env wont change variable set with PerlSetEnv

2002-10-01 Thread Chris Allen

I have a variable that is set with PerlSetEnv in 
my Apache config. 


PerlSetEnv SOMEVAR FOO

On some occasions my PerlTransHandler
changes this variable:


$r->subprocess_env('SOMEVAR','BAR');


This used to work fine, and my PerlHandler (HTML::Embperl) 
would see $ENV{SOMEVAR}=='BAR'



However, I have just upgraded to apache 1.3.26,
mod_perl 1.27 and added mod_ssl 2.8.10, and this
behaviour no longer works.


$r->subprocess_env('SOMEVAR','BAR');

*only* works if SOMEVAR has not previously been
defined in the server config. Otherwise it remains
unchanged.

Any ideas as to what is happening??


Many thanks,


Chris Allen.




Cache::SharedMemoryCache locking up on Solaris

2002-03-12 Thread Chris Allen

I have recently upgraded our modperl based web server
to use Cache::SharedMemoryCache. The code is changed very
little from in the docs - retrieve an entry from the 
cache if it is there, otherwise get an entry from the
database and store it in the cache.

However, after about fifteen minutes of moderate use - probably
with about 50 2-entry arrays stored in the cache and about
1 or so cache hits, the whole system ground to a halt.

You could do $cache=Cache::SharedMemoryCache->new() fine,
but doing:

$cache->set('foo','bar');

would never return.

The server is a Sun E220 running Solaris 7, with Apache 1.3.20
and modperl 1.26

The same configuration on a Linux 2.4 box works fine - over a
soak test of many hundreds of thousands of hits.


If anybody has any ideas, I'd be glad to hear from you!


In desperation, I have switched to Cache::FileCache - which
works fine, but I would be interested to know, for a system
that handles several hundred database queries per minute:

- What is the performance difference between SharedMemoryCache
and FileCache?

- What is the performance difference between FileCache and a
local MySQL database (on a simple indexed query)?

- What about with a LAN connected MySQL database running on
its own machine?

- The SharedMemoryCache docs say that it shouldn't be used
for "large" amounts of information. What size would be considered
"large" on a machine with 4GB RAM?


many thanks,


Chris Allen
[EMAIL PROTECTED]



When to use 'use' for accessing modules?

2001-10-23 Thread Chris Allen

I have a modperl site that accesses a number of modules. 
In my startup.pl I have:


#!/usr/bin/perl -w
use strict;
use lib('/path/to/my/installation'); # 'site' directory is here

use Apache::DBI;
use Apache::StatINC;
use site::customers;
use site::orders;
use site::products;
use site::base;

1;


None of the modules exports *any* symbols at all - all are called in 
the form:

$product=site::products->new(23);
$product->get('price');



First question:

If site::products calls functions from site::customers, do I need
a 'use site::customers' in site::products, when I have already
done a 'use' in my startup.pl?


Second question:

site::products contains the line:

@ISA=('site::base'); 

so that methods from site::base can be overridden in site::products.

Do I need a 'use site::base' in site::products for this to work 
correctly?



Third (unrelated) question.

Is $ENV{foo}='bar'; in startup.pl equivalent to PerlSetEnv foo bar
in httpd.conf?



---

Experience has shown that I *don't* need the 'use' statements anywhere
other than startup.pl - but I am not sure why, and would find some pointers
to a discussion of this very useful. I would also be interested to know that
if the 'use' statements *are* unnecessary, does including them add any extra
overhead of processing/memory??

Many thanks,


Chris Allen.








Setup of CGI.pm failed

2001-09-28 Thread Chris Allen

I am occasionally getting the following message from CGI.pm in $@:

Line 1: Setup of CGI.pm failed:


when HTML::Embperl runs the this line:

eval { $cgi = new CGI };

I am not sure where this message is coming from - it might be mod_perl, it
might be CGI.pm - but I am at a loss to find it. I have even done a search
through all the installed modules on my system to find the word 'Setup', but
none of them appears to be this error.

Does anybody know what might be generating this error? I can't put any
logging in, as I don't know where to start looking!





Re: Apache processes not dying

2001-03-06 Thread Chris Allen

On Tue, Mar 06, 2001 at 10:43:03AM +0800, Stas Bekman wrote:
> > Problem is, that Apache seems to ignore these processes and start new ones
> > without killing them - so I end up with *hundreds* of http processes with
> > the machine swapping like crazy.
> 
> http://perl.apache.org/guide/debug.html#Hanging_Processes_Detection_and
> See also Apache::Watchdog::RunAway
> 

Many thanks. Consider my wrist slapped for not having found this.




Apache processes not dying

2001-03-05 Thread Chris Allen

I am running a site with:

Apache 1.3.9
mod perl 1.21
HTML::Embperl
 

The site is relatively busy - up to 3 hits a day, and has been
running fine for over a year. However in the last two weeks I
have found that I am ending up with a large number of httpd
processes that don't die.

Looking with apache status shows nothing out of the ordinary - 
the processes are usually in the W (sending reply) state - 
however ps shows them as

[httpd]

rather than the more normal 

/usr/local/apache/bin/httpd

which I thought indicated a process that had stopped responding.

Attaching with strace shows the processes are *always* sitting at:

read(46,


Problem is, that Apache seems to ignore these processes and start new ones
without killing them - so I end up with *hundreds* of http processes with
the machine swapping like crazy.

The rogue processes also haven't reached their MaxRequestsPerChild limit of
100 yet either - they are usually at about 20 or 30 or so...


Any ideas as to what I could try to find out what is happening would
be much appreciated - at the moment I am having to kill them all off
with a script at regular intervals!


Chris Allen
[EMAIL PROTECTED]




Upgraded to perl 5.6.0, ImageMagick now gives boot_libapreq error

2000-12-11 Thread Chris Allen

I have just done a complete install of RedHat v7.0 which includes
Perl 5.6.0. Image Magick was running fine on my old system, but now 
when I attempt to install it, it gives the following error message
when attempting to do the PerlMagick install:

./perlmain.o: In function: 'xs_init' :
./perlmain.o(.text+0xc1): undefined reference to  'boot_libapreq'
collect2: ld returned 1 exit status


I have:

Apache 1.3.14
ModPerl 1.24
ImageMagick 5.2.6


If I remove the lines from perlmain.c that talk about boot_libapreq,
then PerlMagic compiles and installs fine, and works from standard
perl scripts, but does not work called from a mod perl handler - hence
the post to this list.

I'd be most grateful if anybody could help!

Chris Allen
[EMAIL PROTECTED]






re: mod perl + proxy returns Document has no data

2000-05-06 Thread Chris Allen

Ok it's definitely a problem with the proxy...

Set the backend running on its own with httpd -X, run a large (3MB) upload 
and everything is fine - so no
mod_perl/embperl problem... (Thanks Gerald!)



Set both the backend and frontend running, both with httpd -X, run the same 
upload:

Frontend appears to accept the upload, but returns a document with no data.

Backend bombs out with:

[error] CGI.pm: Server closed socket during multipart read (client aborted?)

After this, any access to the back-end (directly) returns no data at all 
and is logged
as '200 - ' in the log.

This can be repeated consistently, so I guess this is a mod_proxy problem...

I have worked around by getting the front-end to run embpcgi.pl as a CGI 
script for uploads
which (so far as I have tested) works fine...