Re: Apache2::Cookie blank value bug?

2005-08-24 Thread Jonathan Vanasco


Which versions of :

Apache
mod_perl
libapreq2

?

also, what os

this might be better suited to the libapreq list - but that info is  
kinda needed



On Aug 24, 2005, at 5:40 PM, Ted wrote:


Blank value in cookie causes server to die with a Segmentation Fault.

my $value = '';
my $cookie = Apache2::Cookie->new($r,
   -name => 'test_cookie',
   -value => $value,
   -path => '/',
 );
$cookie->bake($r)







Re: maintaining shared memory size (was: Re:swampedwithconnection?)

2005-08-24 Thread Badai Aqrandista

Hi all,


If the performance you get is not enough for you, look for the
bottleneck.  This could be running out of CPU, running out of memory, or
contention for a shared resource like a database.  Then you fix it, by
changing code or buying hardware.


I'll try that...

Thanks for helping me out... Especially perrin... I'll let you know how it 
goes...


---
Badai Aqrandista
Cheepy (?)

_
SEEK: Over 80,000 jobs across all industries at Australia's #1 job site.
http://ninemsn.seek.com.au?hotmail




Re: Apache2::Cookie blank value bug?

2005-08-24 Thread Dan Brian

On Aug 24, 2005, at 3:40 PM, Ted wrote:


Blank value in cookie causes server to die with a Segmentation Fault.


For me, too.



Apache2::Cookie blank value bug?

2005-08-24 Thread Ted

Blank value in cookie causes server to die with a Segmentation Fault.

my $value = '';
my $cookie = Apache2::Cookie->new($r,
   -name => 'test_cookie',
   -value => $value,
   -path => '/',
 );
$cookie->bake($r)




Re: mod_perl 1.29: send_fh(): result status?

2005-08-24 Thread Brian Gorby

Brian Gorby wrote:

Is this something that's possible in general? with mod_perl?


Found it. Apache::Connection->aborted() is just what I needed.

-Brian



mod_perl2 custom form handler and Motorola i530 phone

2005-08-24 Thread Rodger Castle
This is likely not a strictly mod_perl2 problem, but I'm not finding resolution 
elsewhere.

I have written a custom form data submission parser for our site. Admittedly, 
not one of my wiser decisions, but it works .. until now.

We have a customer trying to use a Motorola i530 phone with a portion of our 
site. Besides not accepting cookies, this phone is doing truly strange things 
with the form submission data. When we pull the form data, the field names have 
doubly-escaped 's and /s surronding the name in the form of %2527 and %255C. 
It's also putting in /' sequences before the requested URL like so .. 
/'/'/'quote.html

Would a more 'standard' form parser alleviate some of this or is this just a 
broken client. I really don't want to introduce a more heavyweight module just 
for this.

Thank you for any guidance that could be given.

Rodger


Re: make test fails (Solaris and Linux, same problem)

2005-08-24 Thread Gordon Lack
> This strange kind of segfaults is usually the syptoms of disagreements in
> large-file support in httpd/apr/perl.
> 
> Detecting these kind of configuration problems has been discussed before, but
> it's not quite as easy as it sounds ;-)
> 
> You can see one of the original discussions about this here:
> http://marc.theaimsgroup.com/?t=11168616962&r=1&w=2

   
   Thanks.  This helped me to get a workaround.

   I run configure through a front-end script and so for Linux and
Solaris Apache2 config I get this to edit the lfs64 defined onto the
EXTRA_CPPFLAGS (there being no other way to get anything into this
variable).  Then things work.  It was odd to see that the
core_dir_config struct was affected, as it didn't seem to contain
anythign file-related, but it turns out that the rlim_t (in struct
rlimit) changes size according to lfs64.

   I actually use Perl to get my compilation options for Apache (since
I'm going to add mod_perl to it) but Perl puts the lfs64 settings onto
CFLAGS rather than CPPFLAGS.

  lib/Apache2/Build.pm has some comments about how Perl and Apache build
64-bit fs versions.  It states:
# This is why it is a really terribly silly idea to ever
# use approach (1) in anything other than an entirely self-contained
# application.

 (approach (1) is using "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64")

   I would disagree totally.  Approach (2) was called transitional for a
reason - it was what you could use while vendors transitioned their
header files to make approach (1) work.  Well written code can use
approach (1) (and hence the same code can produce 32- or 64- bit
versions just by changing the compialtion options).  The binaries
resulting from both approaches is basically the same - it's just the
code you write which differs,



Re: maintaining shared memory size (was: Re: swampedwithconnection?)

2005-08-24 Thread Perrin Harkins
On Wed, 2005-08-24 at 17:49 +1000, Badai Aqrandista wrote:
> I have put a reverse procy in front of my mod_perl servers and I have set 
> MaxClient to 30. I have tried setting it to 50, but it slows down the 
> response time.

Are you running out of memory when you set it to 50?  That's what you
are trying to avoid by setting MaxClients.  Also, you are sending your
load test through the proxy server, and that has a much higher
MaxClients setting, right?

> I ran httperf to create 50 connections. This is the result:
> 
> 1 connections per second  -> avg reply time = 103953.7 ms
> 10 connections per second -> avg reply time = 123167.2 ms
> 20 connections per second -> avg reply time = 121483.7 ms
> 30 connections per second -> avg reply time = 114411.3 ms
> 40 connections per second -> avg reply time = 130168.7 ms
> 50 connections per second -> avg reply time = 130457.4 ms

That looks pretty good to me.  It scales better than linearly, i.e 50
conns is not 50 times slower than 1 conn.

> When only creating 1 connection, the avg reply time = 3289.4 ms

That doesn't seem to be what your numbers above say.

> I have no idea where to start fixing this. It seems that the more connection 
> there is, the higher the avg reply time.

That's true for any web server.  More connections means the machine is
doing more work and running more processes, so of course it will be
slower.  All you need to do is make sure you are not running out of
memory and going into swap.

If the performance you get is not enough for you, look for the
bottleneck.  This could be running out of CPU, running out of memory, or
contention for a shared resource like a database.  Then you fix it, by
changing code or buying hardware.

- Perrin



Re: mod_perl 1.29: send_fh(): result status?

2005-08-24 Thread Perrin Harkins
On Wed, 2005-08-24 at 13:08 -0400, Brian Gorby wrote:
> I'd like to be able to have some sort of confirmation that the file was 
> sent / received in entirety before recording the download; if the 
> download times out for whatever reason for the client, the download will 
> not be recorded.
> 
> Is this something that's possible in general? with mod_perl?

You can tell if the connection gets closed by the client, but you have
to try sending something to check it.  This is in the documentation.

- Perrin




Re: preloading modules in mp2

2005-08-24 Thread Ted

Thank you for helping me out.
mod_apreq2

Philip M. Gollucci wrote:


Ted wrote:


I am not using threads either.


are you loading anything else like
mod_apreq1/2
mod_php

etc




Re: preloading modules in mp2

2005-08-24 Thread Philip M. Gollucci

Ted wrote:

I am not using threads either.

are you loading anything else like
mod_apreq1/2
mod_php

etc


--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: Wondering about MP1 clean up

2005-08-24 Thread Perrin Harkins
On Wed, 2005-08-24 at 09:45 -0500, Boysenberry Payne wrote:
> So it would seem this is a circular reference right?
> How can I get the info I need in each of these without getting caught
> by this?

Some techniques are described here:
http://www.perl.com/pub/a/2002/08/07/proxyobject.html


> I've been using O'reilly books in particular the books in The Perl CD
> Bookshelf v3.0.
> They mentioned an "experimental" WeakRef module for weakening
> references
> to prevent the circular logic thing.  But I usually try and have my
> modules be the
> only "experimental" parts of my apps if possible.  I just found 13.13.
> Coping with Circular Data Structures
> in the Perl Cookbook, maybe that has my solution.

Scalar::Util::weaken is probably what you want.  Be aware of the age of
the books you're using.

- Perrin



Re: preloading modules in mp2

2005-08-24 Thread Ted

I am not using threads either.

Philip M. Gollucci wrote:


Ted wrote:


Hi,

Has anyone experienced a slowdown in the start and stop times of the 
server

when modules are preloaded?  It takes more time to preload under mp2
than under mp1.


I tried this httpd 1.3.33/mp1 1.29 and httpd 2.3.0/mp2 svn head
Both start in stop in ~ 2-3 seconds or less.

Both used perl 5.8.7 WITHOUT THREADS.  Are you using threads in mp2?
Likely thats the cause.


Modules preloaded for the test
---
use Apache::DBI ();
use DBI ();
use Fcntl ();
use File::Copy ();
use HTML::Parser ();
use LWP::Simple ();
use MIME::Lite ();
use XML::Parser ();
use XML::Parser::EasyTree ();
use Encode ();
use Archive::Zip ();
use PDF::API2 ();
use Digest::SHA1 ();






Re: preloading modules in mp2

2005-08-24 Thread Philip M. Gollucci

Ted wrote:

Hi,

Has anyone experienced a slowdown in the start and stop times of the server
when modules are preloaded?  It takes more time to preload under mp2
than under mp1.

I tried this httpd 1.3.33/mp1 1.29 and httpd 2.3.0/mp2 svn head
Both start in stop in ~ 2-3 seconds or less.

Both used perl 5.8.7 WITHOUT THREADS.  Are you using threads in mp2?
Likely thats the cause.

Modules preloaded for the test
---
use Apache::DBI ();
use DBI ();
use Fcntl ();
use File::Copy ();
use HTML::Parser ();
use LWP::Simple ();
use MIME::Lite ();
use XML::Parser ();
use XML::Parser::EasyTree ();
use Encode ();
use Archive::Zip ();
use PDF::API2 ();
use Digest::SHA1 ();



--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: mod_perl 1.29: send_fh(): result status?

2005-08-24 Thread Philip M. Gollucci

Brian Gorby wrote:
I'd like to be able to have some sort of confirmation that the file was 
sent / received in entirety before recording the download; if the 
download times out for whatever reason for the client, the download will 
not be recorded.


Is this something that's possible in general? with mod_perl?

Why would you want to record the download if you didn't finish sending them the 
file :)



--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



mod_perl 1.29: send_fh(): result status?

2005-08-24 Thread Brian Gorby
I'm programming a web application that limits the number of downloads 
for clients on certain files:


...
unless ( $r->header_only ) {
  $r->send_fd($fh);
  $self->record_download($user_id, $file_id);
}
close($fh);

I'd like to be able to have some sort of confirmation that the file was 
sent / received in entirety before recording the download; if the 
download times out for whatever reason for the client, the download will 
not be recorded.


Is this something that's possible in general? with mod_perl?

-Brian



preloading modules in mp2

2005-08-24 Thread Ted

Hi,

Has anyone experienced a slowdown in the start and stop times of the server
when modules are preloaded?  It takes more time to preload under mp2
than under mp1.

mp2, preloading no modules:  start and stop times are on the order of a 
second or less
mp2, preloading modules listed below:  start time is about 10 seconds 
and stop

time is about 5 seconds.

mp1, preloading no modules:  start and stop times are on the order of a 
second or less
mp1, preloading modules listed below:  start time is about 5 seconds and 
stop

time is about 1 second or less.

Modules preloaded for the test
---
use Apache::DBI ();
use DBI ();
use Fcntl ();
use File::Copy ();
use HTML::Parser ();
use LWP::Simple ();
use MIME::Lite ();
use XML::Parser ();
use XML::Parser::EasyTree ();
use Encode ();
use Archive::Zip ();
use PDF::API2 ();
use Digest::SHA1 ();

Preloading more modules results in more of a difference between the two
environments in regard to the start/stop times.  These tests were done on
a sun box running Solaris 9.

Is there anything that can be done to speed this up or is this just the 
nature

of mp2?

Thanks for any information you may have,
Ted


Re: Wondering about MP1 clean up

2005-08-24 Thread Boysenberry Payne
On Aug 24, 2005, at 9:25 AM, Perrin Harkins wrote:

I'm not sure what would be dangerous about that, but I guess there must
be a larger context.

Here is an example I gave on Perl Monks for an example of my issue in a larger context:

package Base;
sub handler {

my $this = {};
bless $this;
$this->{pac1} = new Package1;
$this->{pac2} = new Package2( pac1 => $this->{pac1} );
# print  Dumper $this
}

package Package2;

sub new {

my $class = shift;
my $this = {};
bless( $this, $class );
if (@_) {
my %extra = @_;
@$this{keys %extra} = values %extra;
}
my $pac1 = $this->{pac1};
my $pac3 = new Package3( pac1 => $pac1 );
@$this{pac3} = $pac3;
}

When handler's dumped with Data::Dump shows:
$VAR1 = bless({ 
pac2 => bless({ 
pac3 => bless({pac1 => bless({ some => "value" }, Package1 )}, Pac
+kage3),
pac1 => $VAR1->{pac2}->{pac3}->{pac1}}, Package2),
pac1 => $VAR1->{pac2}->{pac3}->{pac1}}, Base);

So it would seem this is a circular reference right?
How can I get the info I need in each of these without getting caught by this?


What are you trying to tighten up?  Are you still just trying to get rid
of the warnings on shutdown?

Yes getting rid of the warnings, would help me sleep better...


The phases of request handling are documented pretty well on the site
and in various mod_perl books.  The interpreter won't be shut down until
the process exits, but that may be long before the server is shut down
for a particular process.

I've been using O'reilly books in particular the books in The Perl CD Bookshelf v3.0.
They mentioned an "experimental" WeakRef module for weakening references
to prevent the circular logic thing.  But I usually try and have my modules be the
only "experimental" parts of my apps if possible.  I just found 13.13. Coping with Circular Data Structures
in the Perl Cookbook, maybe that has my solution.


Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

Re: Wondering about MP1 clean up

2005-08-24 Thread Boysenberry Payne

On Aug 24, 2005, at 9:19 AM, Philip M. Gollucci wrote:


$Apache::DBI::DEBUG = 2;
$Apache::AuthDBI::DEBUG = 2;


I put them in and didn't notice anything in the error_log.  Maybe I 
need to do something else?


Also, maybe I should mention it's any use statements in the startup.pl
that make the error reappear not just use Apache::DBI()

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: Wondering about MP1 clean up

2005-08-24 Thread Perrin Harkins
On Wed, 2005-08-24 at 08:53 -0500, Boysenberry Payne wrote:
> I'm using an OS X box with MP 1.26 and have striped everything down to 
> a basic
> handler and still get the errors intermittently.  Someone on this list 
> mentioned there
> was a known apache 1.3.33/ MP 1.26 bug something to this effect.  I've 
> resigned myself
> to being ok with this.

They don't sound like a real problem, but I don't get them, so I
wouldn't say you have to resign yourself to having them.

> I was told I should look at the 'foo' => 
> $VAR->{some_scalar} lines
> as possible circular loops.

I'm not sure what would be dangerous about that, but I guess there must
be a larger context.

> When I start up apache I usually get one on start up.  Is this the 
> parent or root httpd?
> Is it normal for it to clean up on start?

When an object goes out of scope, it gets DESTROYed.  This isn't the
whole parent process we're talking about, just one object.

> Am I missing an easier way to get my application tightened up?

What are you trying to tighten up?  Are you still just trying to get rid
of the warnings on shutdown?

> I haven't noticed my httpd 
> processes
> ballooning in memory either, so I should be fine right?

That's the major worry with circular refs, so if you don't see that, you
don't need to worry too much.

> Finally, when does mod_perl do clean up, shut down, each request, or 
> both?

The phases of request handling are documented pretty well on the site
and in various mod_perl books.  The interpreter won't be shut down until
the process exits, but that may be long before the server is shut down
for a particular process.

- Perrin



Re: env and locale

2005-08-24 Thread Arnaud Blancher

Philip M. Gollucci wrote:


Arnaud Blancher wrote:


in apache:

Alias /cgi-p/ /home/publishing4/cgi-p/

   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry
   Options ExecCGI
   allow from all
   PerlOptions +ParseHeaders
#SetEnv LC_CTYPE '[EMAIL PROTECTED]'
# or
   PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]'
 



Hi, fire up Apache2::Status and verify that the env is covered here.


not for PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]'  in  in vhost 
(last time, i forget to mention it)


yes for PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]' in httpd.conf, but for the 
initial problem  no change






SetHandler perl-script
PerlResponseHandler Apache2::Status
PerlSetVar StatusOptionsAll On
PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]'


http://localhost/perl-status

Click on the Environment Link. You should see LC_CTYPE listed here.


true, i see it

does it tell you something ?

Arnaud.










Re: Wondering about MP1 clean up

2005-08-24 Thread Philip M. Gollucci

Boysenberry Payne wrote:

There errors are gone.  If I add:
use Apache::DBI();
in startup.pl I get the errors again...

Try Setting in startup.pl
$Apache::DBI::DEBUG = 2;
$Apache::AuthDBI::DEBUG = 2;

and tail -f /server_root/error_log


--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: Wondering about MP1 clean up

2005-08-24 Thread Boysenberry Payne

On Aug 24, 2005, at 8:58 AM, Philip M. Gollucci wrote:
What happens if you don't load any of YOUR code and just load mp1 with 
a defacto startup.pl file.

Again don't load any of YOUR code.


When I strip it down to just:

PerlRequire /etc/httpd/perl/startup.pl

SetHandler perl-script
PerlHandler Apache::Registry
PerlSendHeader On
Options ExecCGI


startup.pl:

#!/usr/bin/perl
use Apache::Registry();

There errors are gone.  If I add:
use Apache::DBI();
in startup.pl I get the errors again...

Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: maintaining shared memory size (was: Re: swamped withconnection?)

2005-08-24 Thread Perrin Harkins
On Wed, 2005-08-24 at 07:02 -0400, Sean Davis wrote:
> As an aside, are there rules of thumb about what cache works best in various
> situations?

Cache::FastMmap and BerkeleyDB are the fastest by far, but they are
local to one machine.  Cache::Memcached or a simple key/value table in a
MySQL server are second fastest, and can be shared between machines.
After that, everything else is a lot slower.  Some stats are available
here:
http://cpan.robm.fastmail.fm/cache_perf.html

> Are RDBMS's, if accessible, generally a good solution?

For caching?  MySQL is surprisingly fast when handling primary key
requests  against a simple table.  It's faster than Cache::Cache and
most of the other caching modules.

- Perrin



Re: Wondering about MP1 clean up

2005-08-24 Thread Philip M. Gollucci

Boysenberry Payne wrote:
I'm using an OS X box with MP 1.26 and have striped everything down to a 
basic
handler and still get the errors intermittently.  Someone on this list 
mentioned there
was a known apache 1.3.33/ MP 1.26 bug something to this effect.  I've 
resigned myself

to being ok with this.

I believe that was me.

After researching a little on Perl Monks someone said it might be 
circular references
and suggested I use Data::Dump to see whether I do or not.  Another 
thing that they

said I could do was put:
warn "Module Name was Destroyed";
in custom DESTROY blocks.  I tried it and found some of my modules 
weren't being
destroyed properly.  I was told I should look at the 'foo' => 
$VAR->{some_scalar} lines
as possible circular loops.  There were bunches of them.  Which in my 
situation is
pretty hard not to do using OOP.  I'm going through my code now step by 
step and

trying to minimize them, or delete them once they've been used.

What happens if you don't load any of YOUR code and just load mp1 with a 
defacto startup.pl file.
Again don't load any of YOUR code.



My question actually comes from the warn "Module Destroyed" statements.

When I start up apache I usually get one on start up.  Is this the 
parent or root httpd?

Depends, you could fire up gdb and check it out.  Though I don't know how that 
will pan out on OS X.
% gdb httpd
gdb>run -X -d /path/to/serverroot

--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Wondering about MP1 clean up

2005-08-24 Thread Boysenberry Payne
I've been having weirdness with errors in my error_log while stopping 
and starting

apache 1.3.33.  Basically I see:
[warn] child process 867 did not exit, sending another SIGHUP
for every process.  After which I get:
[notice] SIGHUP received.  Attempting to restart
Then it restarts.

I'm using an OS X box with MP 1.26 and have striped everything down to 
a basic
handler and still get the errors intermittently.  Someone on this list 
mentioned there
was a known apache 1.3.33/ MP 1.26 bug something to this effect.  I've 
resigned myself

to being ok with this.

After researching a little on Perl Monks someone said it might be 
circular references
and suggested I use Data::Dump to see whether I do or not.  Another 
thing that they

said I could do was put:
warn "Module Name was Destroyed";
in custom DESTROY blocks.  I tried it and found some of my modules 
weren't being
destroyed properly.  I was told I should look at the 'foo' => 
$VAR->{some_scalar} lines
as possible circular loops.  There were bunches of them.  Which in my 
situation is
pretty hard not to do using OOP.  I'm going through my code now step by 
step and

trying to minimize them, or delete them once they've been used.

My question actually comes from the warn "Module Destroyed" statements.

When I start up apache I usually get one on start up.  Is this the 
parent or root httpd?

Is it normal for it to clean up on start?

Am I missing an easier way to get my application tightened up?
Because the errors are only during start up and shut down I'm not to 
worried about
the error_log ballooning up, should I be?  I haven't noticed my httpd 
processes

ballooning in memory either, so I should be fine right?

Finally, when does mod_perl do clean up, shut down, each request, or 
both?


I hope this is a mod_perl question...

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com



Re: env and locale

2005-08-24 Thread Philip M. Gollucci

Arnaud Blancher wrote:

in apache:

Alias /cgi-p/ /home/publishing4/cgi-p/

   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry
   Options ExecCGI
   allow from all
   PerlOptions +ParseHeaders
#SetEnv LC_CTYPE '[EMAIL PROTECTED]'
# or
   PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]'
 


Hi, fire up Apache2::Status and verify that the env is covered here.


SetHandler perl-script
PerlResponseHandler Apache2::Status
PerlSetVar StatusOptionsAll On
PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]'


http://localhost/perl-status

Click on the Environment Link. You should see LC_CTYPE listed here.




--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: Loading module into apache

2005-08-24 Thread Philip M. Gollucci

Tom Schindl wrote:

Wrong mailing list we are discussing mod-perl question and not mod_example

Maxim, try here:
http://httpd.apache.org/lists.html

specifically:
http://httpd.apache.org/lists.html#http-users

HTH

--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



Re: mp1 to mp2: server info in startup.pl

2005-08-24 Thread Philip M. Gollucci

Tom Schindl wrote:

I would expect none of these solutions to work:

Don;t know if you read my reply to that with the handler example.

1. Solution:
- 
Where from should perl know which port you are refering to / interested
in or turn it the other way round what happens when you server listens
to more than one port on more than one IP addresses?

- ---8<-
Listen 192.170.2.1:80
Listen 192.170.2.5:8000
- ---8<-

This is a good point.



I haven't read the HTTP-API docs of this function but in short this API
doesn't make any sense at least it should return a List and not a Scalar.

I believe the API is copied from httpd's ap [ap_get_server_port()] via XS glue.



2. Solution:
- 
Where from should perl have a request in the startup-phase? The API in
request-context makes sense because an request is really made to one port.

Agreed.  Which is why my   _1st_ response made no sense in hind sight.


You want is retrieving configuration values which can be done using
Apache2::Directive:

I had thought about that, I knew it would work, but I discounted from some 
reason -- can't remember why though.


--
END

What doesn't kill us can only make us stronger.
Nothing is impossible.

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
  http://www.liquidityservicesinc.com
   http://www.liquidation.com
   http://www.uksurplus.com
   http://www.govliquidation.com
   http://www.gowholesale.com



env and locale

2005-08-24 Thread Arnaud Blancher

hi all

with mp2 i can't fix the locale in the httpd.conf and use it in script
it's look like the env variable is set but not use.
In cgi, it's ok

here a sample script:

#!/usr/bin/perl
use CGI qw(:cgi);
print header();
use POSIX qw(locale_h);
$old_locale = setlocale(LC_CTYPE);
print $old_locale,"\n" ;
print "ENV{'LC_CTYPE'} : " .$ENV{'LC_CTYPE'} . "\n";

use locale;
my $texte='aeéio';
print $texte, "\n";
$texte =~s/\W//g;
print $texte, "\n";

--
with mod_perl
--
output

C
ENV{'LC_CTYPE'} : [EMAIL PROTECTED]
aeéio
aeio

wrong, here: é strip

in apache:

Alias /cgi-p/ /home/publishing4/cgi-p/

   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry
   Options ExecCGI
   allow from all
   PerlOptions +ParseHeaders
#SetEnv LC_CTYPE '[EMAIL PROTECTED]'
# or
   PerlSetEnv LC_CTYPE '[EMAIL PROTECTED]'
 

--
in cgi
--
output

[EMAIL PROTECTED]
ENV{'LC_CTYPE'} : [EMAIL PROTECTED]
aeéio
aeéio

ok

in apache
SetEnv LC_CTYPE '[EMAIL PROTECTED]'


MP 2.0.1

perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
 Platform:
   osname=linux, osvers=2.4.21-27.0.2.elsmp, 
archname=i386-linux-thread-multi
   uname='linux decompose.build.redhat.com 2.4.21-27.0.2.elsmp #1 smp 
wed jan 12 23:35:44 est 2005 i686 i686 i386 gnulinux '
   config_args='-des -Doptimize=-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -m32 -march=i386 -mtune=pentium4 
-fasynchronous-unwind-tables -Dversion=5.8.6 -Dmyhostname=localhost 
[EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. 
-Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux 
-Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads 
-Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db 
-Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio 
-Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly 
-Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto 
-Ud_endprotoent_r_proto -Ud_endservent_r_proto -Ud_sethostent_r_proto 
-Ud_setprotoent_r_proto -Ud_setservent_r_proto -Dinc_version_list=5.8.5 
5.8.4 5.8.3'

   hint=recommended, useposix=true, d_sigaction=define
   usethreads=define use5005threads=undef useithreads=define 
usemultiplicity=define

   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
   use64bitint=undef use64bitall=undef uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING 
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE 
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
   optimize='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 
-march=i386 -mtune=pentium4 -fasynchronous-unwind-tables',
   cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING 
-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
   ccversion='', gccversion='4.0.0 20050516 (Red Hat 4.0.0-6)', 
gccosandvers=''

   intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
   d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
   ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
lseeksize=8

   alignbytes=4, prototype=define
 Linker and Libraries:
   ld='gcc', ldflags =' -L/usr/local/lib'
   libpth=/usr/local/lib /lib /usr/lib
   libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc
   perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
   libc=/lib/libc-2.3.5.so, so=so, useshrplib=true, libperl=libperl.so
   gnulibc_version='2.3.5'
 Dynamic Linking:
   dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E 
-Wl,-rpath,/usr/lib/perl5/5.8.6/i386-linux-thread-multi/CORE'

   cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
 Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS 
USE_LARGE_FILES PERL_IMPLICIT_CONTEXT

 Built under linux
 Compiled at May 18 2005 18:21:23
 @INC:
   /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi
   /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi
   /usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi
   /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi
   /usr/lib/perl5/site_perl/5.8.6
   /usr/lib/perl5/site_perl/5.8.5
   /usr/lib/perl5/site_perl/5.8.4
   /usr/lib/perl5/site_perl/5.8.3
   /usr/lib/perl5/site_perl
   /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi
   /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi
   /usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi
   /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi
   /usr/lib/perl5/vendor_perl/5.8.6
   /usr/lib/perl5/vendor_perl/5.8.5
   /usr/lib/perl5/vendor_perl/5.8.4
   /usr/lib/perl5/vendor_perl/5.8.3
   /usr/lib/perl5/vendor_perl
   /usr/lib/perl5/5.8.6/i386-linux-thread-multi
   /usr/lib/perl5/5.8.6


Any idea ?
thank's





Re: Loading module into apache

2005-08-24 Thread Tom Schindl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Maxim Sloyko wrote:
> Hi All!
> 
> I'm sorry if this is the wrong place to post this question, however I
> failed to find more suitable mail-list for Apache-releated questions.
> I've downloaded and compiled Apache 2.0.54 with "mod_example", to take a
> look. When I tried to load the module into my already running server
> (which is 2.0.54 too), I received the following error:
> 
> Syntax error on line 1 of /etc/apache2/mods-enabled/example.load:
> Cannot load /usr/lib/apache2/modules/mod_example.o into server:
> /usr/lib/apache2/modules/mod_example.o: only ET_DYN and ET_EXEC can be
> loaded
> 
> Any help will be really appreciated!
> 
Wrong mailing list we are discussing mod-perl question and not mod_example

Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDDF5vkVPeOFLgZFIRAqY0AJ0Vd4ZiWT8b9cNKJKSDaJo5CVj6TwCeLYPw
pDl5K0TpRTNg7+zNNt6SyAg=
=6i2T
-END PGP SIGNATURE-


Loading module into apache

2005-08-24 Thread Maxim Sloyko

Hi All!

I'm sorry if this is the wrong place to post this question, however I 
failed to find more suitable mail-list for Apache-releated questions.
I've downloaded and compiled Apache 2.0.54 with "mod_example", to take a 
look. When I tried to load the module into my already running server

(which is 2.0.54 too), I received the following error:

Syntax error on line 1 of /etc/apache2/mods-enabled/example.load:
Cannot load /usr/lib/apache2/modules/mod_example.o into server: 
/usr/lib/apache2/modules/mod_example.o: only ET_DYN and ET_EXEC can be 
loaded


Any help will be really appreciated!

--
--
Максим Слойко

begin:vcard
fn:Maxim Sloyko
n:Sloyko;Maxim
email;internet:[EMAIL PROTECTED]
tel;work:231 22 66 ext. 208
tel;cell:+7(905) 767 23 82
version:2.1
end:vcard



Re: maintaining shared memory size (was: Re: swamped withconnection?)

2005-08-24 Thread Sean Davis
On 8/23/05 10:04 PM, "Perrin Harkins" <[EMAIL PROTECTED]> wrote:

> On Wed, 2005-08-24 at 10:31 +1000, Badai Aqrandista wrote:
>> Anyway, to fix this, I'm trying to make my onw shared memory with
>> Apache::SharedMem.
> 
> You can share read-only data by loading it into normal variables during
> startup.  You can share read/write data by keeping it in a database
> (including things like BerkeleyDB or Cache::FastMmap) and only reading
> the small parts of it that you need in each process.

As an aside, are there rules of thumb about what cache works best in various
situations?  Are RDBMS's, if accessible, generally a good solution?  Is
there a document/link giving a comparison?

Thanks,
Sean



Re: Apache, Mod_Perl Upgrade

2005-08-24 Thread Tom Schindl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

[...]
> /opt/perl/bin/perl Makefile.PL MP_APXS=/opt/httpd/bin/apxs
> Reading Makefile.PL args from @ARGV
>   MP_APXS = /opt/httpd/bin/apxs
> no conflicting prior mod_perl version found - good.
> [  error] '/opt/httpd/bin/apxs -q INCLUDEDIR' failed:
> [  error] Can't locate strict.pm in @INC (@INC contains:
> /usr/local/lib/perl5/5.8.7/i686-linux /usr/local/lib/perl5/5.8.7
> /usr/local/lib/perl5/site_perl/5.8.7/i686-linux
> /usr/local/lib/perl5/site_perl/5.8.7 /usr/local/lib/perl5/site_perl .)
> at /opt/httpd/bin/apxs line 19.
> BEGIN failed--compilation aborted at /opt/httpd/bin/apxs line 19.
> [  error] Unable to determine server version, aborting.
> [  error] Invalid MP_APXS specified?


This is completely the wrong perl as you can see from your
"/usr/local/lib/perl5/".

> I have installed perl and apache as described above. Include should be
> /opt/perl? Any ideas? Thanks in advance.

Have you tried to install mp2 using this directory before then I would
suggest that you remove it and unzip mp2.tar.gz once again maybe there's
something left from your last installation try?

> Jon

Tom


-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDDDaPkVPeOFLgZFIRArO9AKCRaU7dxiTdxQgVzWqQsvRbs9VA6QCfTLwi
vd77o0QQqpU6J7dI9imZx7c=
=E8Yd
-END PGP SIGNATURE-


Re: mp1 to mp2: server info in startup.pl

2005-08-24 Thread Tom Schindl
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Philip M. Gollucci wrote:
>> In mp2 I am doing this:
>> ---
>> use Apache2::ServerRec ();
>> use Apache2::ServerUtil ();
>> my $s = Apache2::ServerUtil->server();
>> warn "port = ",$s->port(),"\n";
> 
> Try
> use Apache2::RequestUtil ();
> Apache2::RequestUtil->request()->get_server_port()
> 

I would expect none of these solutions to work:

1. Solution:
- 
Where from should perl know which port you are refering to / interested
in or turn it the other way round what happens when you server listens
to more than one port on more than one IP addresses?

- ---8<-
Listen 192.170.2.1:80
Listen 192.170.2.5:8000
- ---8<-

I haven't read the HTTP-API docs of this function but in short this API
doesn't make any sense at least it should return a List and not a Scalar.

2. Solution:
- 
Where from should perl have a request in the startup-phase? The API in
request-context makes sense because an request is really made to one port.


> Though I don't see why your method doesn't work. I'll give it a spin in
> a bit.
> 

You want is retrieving configuration values which can be done using
Apache2::Directive:

startup.pl:
- -8<-
use Apache2::Directive;

my $tree = Apache2::Directive::conftree();
my @ports = $tree->lookup('Listen');

foreach( @ports ) {
print "The server listens to port: $_\n";
}
- -8<-

httpd.conf:
- -8<-
# 
# 
PerlPostConfigRequire conf/startup.pl
- -8<-
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org

iD8DBQFDDDRvkVPeOFLgZFIRAhIxAJ9htGeljs/zdhHPRmCW1X9m0gCrDACeJVcA
TBm5467aUZbE2aRdXRK6wHg=
=IQBZ
-END PGP SIGNATURE-


Re: maintaining shared memory size (was: Re: swampedwithconnection?)

2005-08-24 Thread Badai Aqrandista



> Does this sound like fixing the wrong problem?

Yes.  Put a reverse proxy in front of your server, tune MaxClients so
you won't go into swap, and then benchmark to see how much load you can
handle.  Then think about tuning.


Thanks for replying...

I have put a reverse procy in front of my mod_perl servers and I have set 
MaxClient to 30. I have tried setting it to 50, but it slows down the 
response time.


This is what top gave me when I hammered the test server with httperf:

--

top - 17:24:27 up 34 days,  9:01,  4 users,  load average: 20.67, 12.84, 
9.26

Tasks: 142 total,   7 running, 135 sleeping,   0 stopped,   0 zombie
Cpu(s): 88.7% us,  7.6% sy,  0.0% ni,  0.0% id,  2.0% wa,  0.0% hi,  1.7% si
Mem:906736k total,   359464k used,   547272k free, 6184k buffers
Swap:  3036232k total,   111564k used,  2924668k free,17420k cached

 PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
22802 www-data  15   0 39664  35m 7968 S 30.7  4.0   0:05.02 apache-perl
22370 www-data  16   0 39664  35m 7968 S 12.8  4.0   0:03.45 apache-perl
13604 www-data  17   0 40096  35m 7968 R  5.7  4.0   0:30.93 apache-perl
15424 root  15   0 32060 7668 1560 S  3.8  0.8   6:49.47 memcached
13611 www-data  15   0 40036  35m 7968 S  3.5  4.0   0:17.13 apache-perl
22804 www-data  17   0 39664  35m 7968 R  3.1  4.0   0:03.01 apache-perl
13612 www-data  16   0 40032  35m 7968 S  0.7  4.0   0:33.38 apache-perl



I ran httperf to create 50 connections. This is the result:

1 connections per second -> avg reply time = 103953.7 ms
10 connections per second -> avg reply time = 123167.2 ms
20 connections per second -> avg reply time = 121483.7 ms
30 connections per second -> avg reply time = 114411.3 ms
40 connections per second -> avg reply time = 130168.7 ms
50 connections per second -> avg reply time = 130457.4 ms

When only creating 1 connection, the avg reply time = 3289.4 ms
When creating 10 connections, with 1 conn per second, the avg reply time = 
25929.7 ms


I have no idea where to start fixing this. It seems that the more connection 
there is, the higher the avg reply time.


Does anyone ever experienced this? Why does it happen?
Basically I just want to make my webapp ready to launch... (doesn't anyone?)

THANK YOU...

---
Badai Aqrandista
Cheepy (?)

_
SEEK: Over 80,000 jobs across all industries at Australia's #1 job site.
http://ninemsn.seek.com.au?hotmail