Re: Running multiple copies of same site in ModPerl

2011-11-30 Thread Nishikant Kapoor

Michael Peters wrote:

On 11/29/2011 10:29 PM, Nishikant Kapoor wrote:


I have been running a ModPerl site fine with following configuration.
The problem started when I made a complete copy of the original site and
tried to run the two in the same environment. For some reason, calling
up the ORIG site (http://127.0.0.1/ORIG/) now calls the COPY site at
http://127.0.0.1/COPY/. None of the changes made in ORIG::MODS::base.pm
are getting picked up even after restarting the apache server. However,
changes to COPY::MODS::base.pm are showing up fine.


The problem is that mod_perl uses the same Perl interpreter for 
everything (by default) and that interpreter is persistent. I'm 
guessing that your "package" declaration in ORIG::MODS::base.pm and 
COPY::MODS::base.pm are the same. Perl won't load 2 packages of the 
same name. The usual solutions are:
I thought about that too, and so I did change the "package" declaration 
in ORIG::MODS::base.pm and COPY::MODS::base.pm but calling up 
http://127.0.0.1/ORIG/ still calls http://127.0.0.1/COPY/. Here is what 
each base.pm has:


/var/www/perl/COPY/MODS/base.pm:
package COPY::MODS::base;

/var/www/perl/ORIG/MODS/base.pm:
package ORIG::MODS::base;

And, as gAzZaLi suggested, I also tried switching the order of the ORIG 
and COPY lines in startup.pl, and I could see the changes made in ORIG 
but not the changes in COPY. So, COPY indeed is overriding ORIG.


As for the #2 mentioned below, are there any pointers that you could 
refer to?


Thanks,
Nishi


1) rename your modules so that they don't have the same package names.

2) run multiple separate apaches on the same physical server (not as 
hard as it seems to most people and pretty easy to do if you're 
running a proxy in front. And you really should be running a proxy in 
front).


3) Try to have multiple Perl interpreters using a different Apache 
MPM. I haven't seen anyone give a definitive guide to how to do this 
(although I could have missed something) and results seem to be mixed.


I prefer #2 and use it constantly. It also makes it really easy to 
have separate dev environments each using their own code.






Running multiple copies of same site in ModPerl

2011-11-29 Thread Nishikant Kapoor

Hello List,

I have been running a ModPerl site fine with following configuration. 
The problem started when I made a complete copy of the original site and 
tried to run the two in the same environment. For some reason, calling 
up the ORIG site (http://127.0.0.1/ORIG/) now calls the COPY site at 
http://127.0.0.1/COPY/. None of the changes made in ORIG::MODS::base.pm 
are getting picked up even after restarting the apache server. However, 
changes to COPY::MODS::base.pm are showing up  fine.


Would appreciate any help. Here is what I have in the config:

/etc/httpd/conf/httpd.conf:
---
PerlRequire /var/www/perl/startup.pl

 SetHandler perl-script
 PerlResponseHandler ORIG::MODS::base



 SetHandler perl-script
 PerlResponseHandler COPY::MODS::base


/var/www/perl/startup.pl:
-
use lib qw(/var/www/perl);
use lib qw(/var/www/perl/ORIG);
use lib qw(/var/www/perl/COPY);
1;

Apache/2.2.14 (Mandriva Linux/PREFORK-1mdv2010.0)
apache-mod_perl-2.0.4-11mdv2010.0
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Thanks,
Nishi



mod_perl memory...

2010-05-28 Thread Nishikant Kapoor

Hello,

Following the thread 
http://www.gossamer-threads.com/lists/modperl/modperl/101225, I came up 
with the following sub to display the output but the memory usage 
continues to build up without limit when web pages are rendered. Any 
suggestion/pointer would be greatly appreciated.


Here is the sub that outputs the page ($data is the entire web page in 
one go, using HTML::Template):


sub sendOutput {
  my $r = shift;
  my $data = shift;

  $r->content_type("text/html; charset=UTF-8");

  my $ba=$r->connection->bucket_alloc;
  my $bb=APR::Brigade->new($r->pool, $ba);

  $bb->insert_tail(APR::Bucket->new($ba, $data));
  $bb->insert_tail(APR::Bucket::flush_create $ba);
  $r->output_filters->pass_brigade($bb);
  $bb->cleanup;

  $bb->insert_tail(APR::Bucket::eos_create $ba);
  $r->output_filters->pass_brigade($bb);

  return;
}

And, here is the 'free' snapshot every ten seconds (trimmed):
  total   used   free
Mem: 262144  34668 227476
Mem: 262144  48432 213712
Mem: 262144  53392 208752
Mem: 262144  64360 197784
Mem: 262144  60760 201384
Mem: 262144  38980 223164
Mem: 262144  56440 205704
Mem: 262144  57436 204708
Mem: 262144  77364 184780
Mem: 262144 107568 154576
Mem: 262144 123388 138756
Mem: 262144 138628 123516
Mem: 262144 149004 113140

Thanks,
Nishi


Re: Apache2::RequestIO::print: (103) Software caused connection abort at ...

2010-05-22 Thread Nishikant Kapoor

Torsten Förtsch,

You are awesome! That was it.

I had a line in there just before '$r->print($tmpl->output)'

  $r->content_type("text/html; charset=ISO-8859-1\n\n");

I removed the two \n and now, it is working great with both IE and FF..

Really, truly appreciate it.
Nishi


Torsten Förtsch wrote:

On Saturday 22 May 2010 15:53:09 Nishikant Kapoor wrote:

Hello there,

I have been trying to figure it out for over a week now but without much
success. Could really use some help.

When I visit my site http://www.Channelorama.com/DH/?act=home using IE,
I see the following error in the apache error log. And, IE hangs in a
'working' loop, without displaying the page.

[Thu May 20 03:01:08 2010] [error] Apache2::RequestIO::print: (103)
Software caused connection abort at ...util.pm line 855

The line it is complaining about is

   $r->print($tmpl->output);

The strange part is that this error shows up ONLY when browsing via IE
(version 6 and 8; haven't tried others). But, when browsing the same
site using FF (3.5.3) on Linux, it seems to be working just fine. No
errors in the log.

Has anyone experienced this/similar issue? If so, could you please share
how you resolved it? Here is my setup:



Your server claims to do chunked output. That means the first output line 
contains the length of the first chunk. But it does not obey the protocol.


$ curl -v 'http://www.channelorama.com/DH/?act=home' --raw 
* About to connect() to www.channelorama.com port 80 (#0)
*   Trying 74.126.19.227... connected
* Connected to www.channelorama.com (74.126.19.227) port 80 (#0) 
GET /DH/?act=home HTTP/1.1 
User-Agent: curl/7.19.6 (x86_64-unknown-linux-gnu) libcurl/7.19.6 

OpenSSL/0.9.8k zlib/1.2.3 libidn/1.10
Host: www.channelorama.com 
Accept: */*
   

< HTTP/1.1 200 OK
< Date: Sat, 22 May 2010 14:04:20 GMT
< Server: Apache/2.2.15 (Unix) PHP/5.2.6 mod_perl/2.0.4 Perl/v5.8.8
< Transfer-Encoding: chunked
< Content-Type: text/html; charset=ISO-8859-1
<
 <-- here the length of the chunk is expected

16204<-- but it only comes here. You print 2 empty lines before the
 first chunk



Here an example how it should look like:

$ curl -v 'http://www.bahn.de/p/view/index.shtml' --raw
* About to connect() to www.bahn.de port 80 (#0)
*   Trying 81.200.198.6... connected
* Connected to www.bahn.de (81.200.198.6) port 80 (#0)  
GET /p/view/index.shtml HTTP/1.1  
User-Agent: curl/7.19.6 (x86_64-unknown-linux-gnu) libcurl/7.19.6 

OpenSSL/0.9.8k zlib/1.2.3 libidn/1.10
Host: www.bahn.de  
Accept: */*
   
< HTTP/1.1 200 OK
< Date: Sat, 22 May 2010 14:07:44 GMT
< Server: Apache 
< Accept-Ranges: bytes   
< Transfer-Encoding: chunked 
< Content-Type: text/html
<
376e <-- the length of the first chunk is the first line of output



"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>


Torsten Förtsch





Apache2::RequestIO::print: (103) Software caused connection abort at ...

2010-05-22 Thread Nishikant Kapoor

Hello there,

I have been trying to figure it out for over a week now but without much 
success. Could really use some help.


When I visit my site http://www.Channelorama.com/DH/?act=home using IE, 
I see the following error in the apache error log. And, IE hangs in a 
'working' loop, without displaying the page.


[Thu May 20 03:01:08 2010] [error] Apache2::RequestIO::print: (103) 
Software caused connection abort at ...util.pm line 855


The line it is complaining about is

  $r->print($tmpl->output);

The strange part is that this error shows up ONLY when browsing via IE 
(version 6 and 8; haven't tried others). But, when browsing the same 
site using FF (3.5.3) on Linux, it seems to be working just fine. No 
errors in the log.


Has anyone experienced this/similar issue? If so, could you please share 
how you resolved it? Here is my setup:


CentOS release 5 (Final)
HTML-Template-2.5
Apache/2.2.15 (Unix)  PHP/5.2.6  mod_perl/2.0.4  Perl/v5.8.8

Thanks,
Nishi