Help -- how to fork an Apache process in mod_perl safely? Not Apache2:Subprocess...

2009-08-25 Thread Victor Danilchenko

Hi all,

	I need to be able to fork an Apache process in daemon form, to do some 
housekeeping which might potentially take a few seconds. However, when I 
do that, I start getting SQL errors (of the connection lost type) in 
the browser. I do the fairly standard cleanup to daemonize the child 
process, but of course it needs to retain the SQL socket open. Here is 
my forking code:


sub modperl_kamikaze_fork () {
# You will have to do CORE::exit(0) at the end of the execution.

$SIG{CHLD} = 'IGNORE';
get_m-flush_buffer;
defined (my $kid = fork) or die Cannot fork: $!\n;
return $kid if $kid;

my $r = get_r;
close STDIN; open STDIN, '/dev/null'
or die Can't read /dev/null: $!;
close STDOUT; open STDOUT, '/dev/null'
or die Can't write to /dev/null: $!;
close STDERR; open STDERR, '/tmp/form.log'
or die Cannot open /tmp/fork.log\n;
setsid
or die Can't start a new session: $!;

my $oldfh = select STDERR;
local $| = 1;
select $oldfh;
warn Child (PID $$) spawned.\n;

$r-child_terminate;
}


	The Apache2:Subprocess doesn't help me, because I need not to spawn an 
external process, but to finish processing in mod_perl context -- just 
without bugging the user with it.


	Any ideas on how to either fork better, or how to solve this without 
forking (e.g. is there a way to 'append' a function call to the request 
after the rest of the request is completed)?


Many thanks in advance.

--
Victor Danilchenko
Senior Software Engineer, AskOnline.net
vic...@askonline.net - 617-273-0119


Re: Help -- how to fork an Apache process in mod_perl safely? Not Apache2:Subprocess...

2009-08-25 Thread Perrin Harkins
On Tue, Aug 25, 2009 at 8:11 AM, Victor Danilchenkovic...@askonline.net wrote:
        I need to be able to fork an Apache process in daemon form, to do
 some housekeeping which might potentially take a few seconds. However, when
 I do that, I start getting SQL errors (of the connection lost type) in the
 browser. I do the fairly standard cleanup to daemonize the child process,
 but of course it needs to retain the SQL socket open.

You can't fork and keep using a database connection.  You have to open
a new connection in the forked process.

        The Apache2:Subprocess doesn't help me, because I need not to spawn
 an external process, but to finish processing in mod_perl context -- just
 without bugging the user with it.

In that case, just use a cleanup handler instead.

- Perrin


Re: Help -- how to fork an Apache process in mod_perl safely? Not Apache2:Subprocess...

2009-08-25 Thread Igor Chudov
my solution is here:

sub fork_temporary_child {
  my $result = fork();
  unless( $result ) {
# Do not use SQL in child
dbh-{InactiveDestroy} = 1;
disconnect_dbh;
  }
  return $result;
}



On Tue, Aug 25, 2009 at 7:11 AM, Victor Danilchenko vic...@askonline.netwrote:

Hi all,

I need to be able to fork an Apache process in daemon form, to do
 some housekeeping which might potentially take a few seconds. However, when
 I do that, I start getting SQL errors (of the connection lost type) in the
 browser. I do the fairly standard cleanup to daemonize the child process,
 but of course it needs to retain the SQL socket open. Here is my forking
 code:

 sub modperl_kamikaze_fork () {
# You will have to do CORE::exit(0) at the end of the execution.

$SIG{CHLD} = 'IGNORE';
get_m-flush_buffer;
defined (my $kid = fork) or die Cannot fork: $!\n;
return $kid if $kid;

my $r = get_r;
close STDIN; open STDIN, '/dev/null'
or die Can't read /dev/null: $!;
close STDOUT; open STDOUT, '/dev/null'
or die Can't write to /dev/null: $!;
close STDERR; open STDERR, '/tmp/form.log'
or die Cannot open /tmp/fork.log\n;
setsid
or die Can't start a new session: $!;

my $oldfh = select STDERR;
local $| = 1;
select $oldfh;
warn Child (PID $$) spawned.\n;

$r-child_terminate;
 }


The Apache2:Subprocess doesn't help me, because I need not to spawn
 an external process, but to finish processing in mod_perl context -- just
 without bugging the user with it.

Any ideas on how to either fork better, or how to solve this without
 forking (e.g. is there a way to 'append' a function call to the request
 after the rest of the request is completed)?

Many thanks in advance.

 --
Victor Danilchenko
Senior Software Engineer, AskOnline.net
vic...@askonline.net - 617-273-0119



At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
My website algebra.com has been moved to a new server running Ubuntu Hardy.

While everything seems to be working well, esp. the kernel and solid state
disk, I have one issue.

The issue is that at random moments, usually once or twice a day, my
webserver starts returning completely empty pages instead of actual content.
The pages are mod_perl based.

I tried restarting apache every 30 minutes, but it does not help. It appears
to be a random issue as opposed to a server getting tired issue.

I have a cron job that checks my webserver every 5 minutes and restarts it
when necessary, but obviously I hate the situation and would like to fix it.


Any pointers to get started would be appreciated.

Igor


Re: Help -- how to fork an Apache process in mod_perl safely? Not Apache2:Subprocess...

2009-08-25 Thread William T
There are all kinds of problems that you'll encounter and have to solve if
you fork.  I found it's better to call at(1) to start another seperate
process immediatly.  If you need to pass data JSON worked really well for
me.

-wjt

On Aug 25, 2009 5:12 AM, Victor Danilchenko vic...@askonline.net wrote:

   Hi all,

   I need to be able to fork an Apache process in daemon form, to do
some housekeeping which might potentially take a few seconds. However, when
I do that, I start getting SQL errors (of the connection lost type) in the
browser. I do the fairly standard cleanup to daemonize the child process,
but of course it needs to retain the SQL socket open. Here is my forking
code:

sub modperl_kamikaze_fork () {
   # You will have to do CORE::exit(0) at the end of the execution.

   $SIG{CHLD} = 'IGNORE';
   get_m-flush_buffer;
   defined (my $kid = fork) or die Cannot fork: $!\n;
   return $kid if $kid;

   my $r = get_r;
   close STDIN; open STDIN, '/dev/null'
   or die Can't read /dev/null: $!;
   close STDOUT; open STDOUT, '/dev/null'
   or die Can't write to /dev/null: $!;
   close STDERR; open STDERR, '/tmp/form.log'
   or die Cannot open /tmp/fork.log\n;
   setsid
   or die Can't start a new session: $!;

   my $oldfh = select STDERR;
   local $| = 1;
   select $oldfh;
   warn Child (PID $$) spawned.\n;

   $r-child_terminate;
}


   The Apache2:Subprocess doesn't help me, because I need not to spawn
an external process, but to finish processing in mod_perl context -- just
without bugging the user with it.

   Any ideas on how to either fork better, or how to solve this without
forking (e.g. is there a way to 'append' a function call to the request
after the rest of the request is completed)?

   Many thanks in advance.

-- 
   Victor Danilchenko
   Senior Software Engineer, AskOnline.net
   vic...@askonline.net - 617-273-0119


mod_perl on win32

2009-08-25 Thread Michiel Beijen
Hi all,

I'd like to know if it's possible to build mod_perl on Win32; I'd like
to use mod_perl with StrawberryPerl. It seems to be that the only way
that could be done is to compile Apache also with MinGW, and that's not
possible because of limited support for Windows Shared Memory in MinGW.

Also if you'd try to compile mod_perl it will try to run ./configure
on the Apache sources but that will fail on Win32 because 1. there is no
Configure in the win32 Apache sources and 2. Windows will try to execute
. which is not exactly an executable file...

Does anyone have pointers or tips?

Thanks in advance,
-- 
Michiel Beijen


((otrs)) :: OTRS AG :: Norsk-Data-Straße 1 :: 61352 Bad Homburg
Phone: +49 (0) 6172 681988 0 :: Fax: +49 (0) 9421 56818 18
  http://www.otrs.com/ :: Communication with success!


Geschäftssitz: Bad Homburg
Amtsgericht Bad Homburg, HRB 10751
Steuernummer: 003 240 97505
Aufsichtsratsvorsitzender: Burchard Steinbild
Vorstand: André Mindermann (Vorsitzender), Martin Edenhofer

NEU! ENTERPRISE SUBSCRIPTION - JETZT informieren und buchen!
http://www.otrs.com/de/support/enterprise-subscription/


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Fred Moyer
On Tue, Aug 25, 2009 at 8:09 AM, Igor Chudovichu...@gmail.com wrote:
 My website algebra.com has been moved to a new server running Ubuntu Hardy.

 While everything seems to be working well, esp. the kernel and solid state
 disk, I have one issue.

 The issue is that at random moments, usually once or twice a day, my
 webserver starts returning completely empty pages instead of actual content.
 The pages are mod_perl based.

 I tried restarting apache every 30 minutes, but it does not help. It appears
 to be a random issue as opposed to a server getting tired issue.

 I have a cron job that checks my webserver every 5 minutes and restarts it
 when necessary, but obviously I hate the situation and would like to fix it.

 Any pointers to get started would be appreciated.

Please post your version details, and the relevant sections of httpd.conf.

Have you witnessed this?  Are you able to get any server response headers?


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
On Tue, Aug 25, 2009 at 10:32 AM, Frank Wiles fr...@wiles.org wrote:


 Hmmm, that's a difficult situation to debug.  Are you running anything
 in front of apache/mod_perl like perlbal or nginx?  If so, those might
 be the cause.


I am running perlbal in front of apache, yes. perlbal is a complete
lifesaver for me, because my site is high traffic and perlbal takes care of
lingering prowsers and such, to keep the number of my apache processes down.

When I restart apache, I do not restart perlbal. I use perlbal everywhere,
including on my old Fedora server, and it seems to be very stable.



 My suggestion would be to run a separate instance of your app on a
 high port with a single apache instance and see if you can find a way
 to reliably reproduce the problem. Then, if there isn't anything
 useful in the error log, use the debugger to step through the code as
 you reproduce the issue from the browser.


I am afraid that it is hard to reproduce. Since I run ads and such, I cannot
really afford to pause for very long to debug the issue, plus it happens
randomly. My 5 minute restarter saves me from a very big trouble


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Michael Peters

Fred Moyer wrote:


The issue is that at random moments, usually once or twice a day, my
webserver starts returning completely empty pages instead of actual content.
The pages are mod_perl based.


I've seen this happen sometimes when something segfaults. And segfaults are 
usually the result of having incompatible binaries/libs on your system. Is there 
anything in your error logs about this?


--
michael peters

I played golf... I did not get a hole in one, but I did hit a guy. That's way 
more satisfying. - Mitch Hedberg


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Perrin Harkins
On Tue, Aug 25, 2009 at 11:09 AM, Igor Chudovichu...@gmail.com wrote:
 The issue is that at random moments, usually once or twice a day, my
 webserver starts returning completely empty pages instead of actual content.

What's in the error_log?

- Perrin


Re: mod_perl on win32

2009-08-25 Thread William A. Rowe, Jr.
Michiel Beijen wrote:
 
 I'd like to know if it's possible to build mod_perl on Win32; I'd like
 to use mod_perl with StrawberryPerl. It seems to be that the only way
 that could be done is to compile Apache also with MinGW, and that's not
 possible because of limited support for Windows Shared Memory in MinGW.

There are various flaws in the build, report them to d...@httpd or collect
them in bugzilla reports, and mind the existing reports which might already
solve your problem.

Since there is no MinGW port maintainer, this often falls apart, sorry there
is nothing we can do if a platform's community does not participate with or
engage the developers with patches.

 Also if you'd try to compile mod_perl it will try to run ./configure
 on the Apache sources but that will fail on Win32 because 1. there is no
 Configure in the win32 Apache sources and 2. Windows will try to execute
 . which is not exactly an executable file...
 
 Does anyone have pointers or tips?

You don't use the -win32-src package because that package is for building
on the Microsoft Windows platform.  If you want to build for a faux-unix
platform you would obtain the usual tarball.


RE: mod_perl on win32

2009-08-25 Thread Steve Hay
William A. Rowe, Jr. wrote on 2009-08-25:
 Michiel Beijen wrote:
  I'd like to know if it's possible to build mod_perl on Win32; I'd like
 to use mod_perl with StrawberryPerl. It seems to be that the only way
 that could be done is to compile Apache also with MinGW, and that's not
 possible because of limited support for Windows Shared Memory in
 MinGW.
 
 There are various flaws in the build, report them to d...@httpd or
 collect them in bugzilla reports, and mind the existing reports which
 might already solve your problem.

The other option, if you didn't specifically want to use StrawberryPerl, is to 
build perl, apache  mod_perl with VC++ 2008 Express.


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
Nothing much is in error_log, I do print some of my outputs, but nothing of
interest.

What I know is that I can retrieve www.algebra.com/apache-status, it works
fine.

However, retrieving mod_perl pages returns empty pages.

Igor

On Tue, Aug 25, 2009 at 11:14 AM, Perrin Harkins phark...@gmail.com wrote:

 On Tue, Aug 25, 2009 at 11:09 AM, Igor Chudovichu...@gmail.com wrote:
  The issue is that at random moments, usually once or twice a day, my
  webserver starts returning completely empty pages instead of actual
 content.

 What's in the error_log?

 - Perrin



Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
On Tue, Aug 25, 2009 at 10:50 AM, Frank Wiles fr...@wiles.org wrote:



  I am afraid that it is hard to reproduce. Since I run ads and such, I
 cannot
  really afford to pause for very long to debug the issue, plus it happens
  randomly. My 5 minute restarter saves me from a very big trouble

 No of course, that's why I suggested running it on a higher port and
 leaving your production site alone.  Just to isolate the problem down
 as small as possible.  (i.e. no perlbal, single apache process, no
 other users, etc. ) to see if you can narrow down what piece of the
 puzzle is the one causing the issue.

 Frank, I tried to run apache2 -X and did thousands of queries, they did not
 break anything. It is something else.


Re: segfaults: I do get segfaults in apache, indeed.

Re: httpd config file: See attached. It is kind of big.


httpd.conf
Description: Binary data


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Perrin Harkins
On Tue, Aug 25, 2009 at 1:07 PM, Igor Chudovichu...@gmail.com wrote:
 Nothing much is in error_log, I do print some of my outputs, but nothing of
 interest.

 What I know is that I can retrieve www.algebra.com/apache-status, it works
 fine.

 However, retrieving mod_perl pages returns empty pages.

If you mean that they don't render in the browser, it would help if
you look at the content being sent instead.  It must be sending
something, or you'd get a timeout error.

- Perrin


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Fred Moyer
One great tool that would help with the diagnosis is the very useful
mp2bug, found in mod_perl-2.0/bin/mp2bug

Can you run that from your mod_perl install and post the output?
Version details are a huge clue in solving mysteries like this.

On Tue, Aug 25, 2009 at 10:10 AM, Igor Chudovichu...@gmail.com wrote:


 On Tue, Aug 25, 2009 at 10:50 AM, Frank Wiles fr...@wiles.org wrote:


  I am afraid that it is hard to reproduce. Since I run ads and such, I
  cannot
  really afford to pause for very long to debug the issue, plus it happens
  randomly. My 5 minute restarter saves me from a very big trouble

 No of course, that's why I suggested running it on a higher port and
 leaving your production site alone.  Just to isolate the problem down
 as small as possible.  (i.e. no perlbal, single apache process, no
 other users, etc. ) to see if you can narrow down what piece of the
 puzzle is the one causing the issue.

 Frank, I tried to run apache2 -X and did thousands of queries, they did
 not break anything. It is something else.

 Re: segfaults: I do get segfaults in apache, indeed.

 Re: httpd config file: See attached. It is kind of big.



Re: mod_perl2 interactive startup

2009-08-25 Thread amalek


Malloy - thanks for responding.

Unfortunately using restart_count does not address my issue.

In the http.conf I have the following:
...
PerlConfigRequire   conf/startup.pl
...

My test startup.pl has this:

our $INPUT;
print STDERR Input:;
$INPUT = STDIN;
print STDERR you entered $INPUT;

My issue is during the first start everything works as I need it to,  
Input: is printed out to the terminal and the script waits for input.


The problem is for the automatic restart everything is tied to the log files.
Everything printed to STDERR goes into the logs and a user cannot  
enter any input.


For the restart how can I print messages and prompt for input?

Thanks.

---Alex

Quoting Malloy jackwor...@gmail.com:


Dealing with Restarts

Ideally the code running at the server startup shouldn't be affected by the
apache restart. If however this is not the case, you can use
Apache2::ServerUtil::restart_count.

More Info:  http://perl.apache.org/docs/2.0/user/handlers/server.html


On Wed, Aug 19, 2009 at 4:54 AM, ama...@solutionsforprogress.com wrote:


I am in the process of porting a mod_perl app to mod_perl2.

The original mod_perl app has an interactive startup during which a DB
password is prompted for.

During the mod_perl2 startup this feature works fine at first but mod_perl2
always does a restart and during the second restart STDERR is being
redirected to the log files and STDIN is ignored.

So I am trying to figure out how to either:
1) Prevent the automatic restart or
2) Have STDERR and STDIN be tied to the terminal during the restart the
same way they are during the initial start

Here info about my system: Apache/2.2.9 (Debian) mod_apreq2-20051231/2.6.0
mod_perl/2.0.4 Perl/v5.10.0

Thank you in advance for any help/insight.

--Alex





--
Jack Malloy







Re: mod_perl on win32

2009-08-25 Thread Jean-Damien Durand

Michiel Beijen a écrit :

I'd like to know if it's possible to build mod_perl on Win32; I'd like
to use mod_perl with StrawberryPerl. It seems to be that the only way
that could be done is to compile Apache also with MinGW, and that's not
possible because of limited support for Windows Shared Memory in MinGW
  
Here is how I installed StrawberryPerl + mod_perl + apache2 on Windows 
(tested onVista):


1. Apache
Go to http://httpd.apache.org/download.cgi
Click on /Win32 Binary including OpenSSL 0.9.8i (MSI Installer) /
Some recommend to install it in a directory without space, although I 
did not do that and it still work.


2. Perl
Go to http://strawberryperl.com/ and install the latest kit

3.  I then use the script send in attachement to install all modules I 
need, e.g. perl install_modules.pl


At the top of the script you will see how to get mod_perl2 and various 
other stuff I need for my project. Just the lines for the modules you do 
not need.


HTH,

Cheers, JD.

#!/usr/bin/perl

#
## This script, intended to be run by an installer on Windows
## will hopefully verify packages needed by Freecity are
## installed - and will attempt to install them if needed
#
## (c) 2008 by Jean-Damien Durand jeandamiendur...@free.fr
#
use 5.10.0;
use strict;
use diagnostics;
use Config;
use File::Spec;
use CPAN;

my %required_modules = (
'mod_perl2' = 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/mod_perl.ppd',
'Apache2::Request'  = 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/libapreq2.ppd',
'GD'= 'http://www.bribes.org/perl/ppm/GD.ppd',
'GD::Text'  = 'http://www.bribes.org/perl/ppm/GDTextUtil.ppd',
'Template'  = 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/Template-Toolkit.ppd',
'Config::General'   = 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/Config-General.ppd',
'Apache::DBI'   = 'http://trouchelle.com/ppm10/Apache-DBI.ppd',
'CGI::Simple'   = 'http://trouchelle.com/ppm10/CGI-Simple.ppd',
'HTML::Tree'= 'http://trouchelle.com/ppm10/HTML-Tree.ppd',
'File::Type'= 'http://trouchelle.com/ppm10/File-Type.ppd',
'Image::Size'   = 'http://trouchelle.com/ppm10/Image-Size.ppd',
'Net::Telnet'   = 'http://trouchelle.com/ppm10/Net-Telnet.ppd',
'I18N::Charset' = 'http://trouchelle.com/ppm10/I18N-Charset.ppd',
'XML::RSS'  = 'http://trouchelle.com/ppm10/XML-RSS.ppd',
'Win32::Process'= 'http://trouchelle.com/ppm10/Win32-Process.ppd',
'Win32::DriveInfo'  = 'http://trouchelle.com/ppm10/Win32-DriveInfo.ppd',
'List::MoreUtils'   = 
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/List-MoreUtils.ppd',
'Win32::FileOp' = 'http://trouchelle.com/ppm10/Win32-FileOp.ppd',
'Win32::Service'= 'http://trouchelle.com/ppm10/Win32-Service.ppd',
'Win32::OLE'= 'http://www.bribes.org/perl/ppm/Win32-OLE.ppd',
'Text::Chomp'   = 'http://trouchelle.com/ppm10/Text-Chomp.ppd',
'Number::Format'= 'http://trouchelle.com/ppm10/Number-Format.ppd',
'Object::Multitype' = 'http://trouchelle.com/ppm10/Object-MultiType.ppd',
'Win32::IPHelper'   = 'http://trouchelle.com/ppm10/Win32-IPHelper.ppd',
'NetAddr::IP'   = 'http://trouchelle.com/ppm10/NetAddr-IP.ppd'
);
   
print \n;
print \n;
print Freecity va verifier et installer si necessaire des \n;
print modules perl necessaires a son fonctionnement.  \n;
print \n;
print \n;
print Appuyez sur Entree ou Return pour continuer   \n;
print \n;

my $dummy;
read(STDIN, $dummy, 1);

#  -
## Get install directory of perl
#  -
my $installbin = $Config{installbin} || die No installbin in perl config !?\n;
my $installsitelib = $Config{installsitelib} || die No installsitelib in perl 
config !?\n;

#  ---
## This is for Time::ParseDate
#  ---
$ENV{TZ}='PST8PDT';

#  --
## Check required modules
#  --
my $module;
my $cpanmod;
my $ppm = File::Spec-catfile($installbin, 'ppm.bat');
foreach $module (sort keys %required_modules) {
my $found = 0;
#
## For GD we force the installation
#
if ($module ne 'GD') {
foreach $cpanmod (CPAN::Shell-expand(Module, $module)){
++$found;
if ($cpanmod-inst_file) {
print $cpanmod-id,  is already installed\n;
next;
}
install_module($module);
last;
}
} else {
print Forcing $module installation\n;
}
if ($found == 0) {
install_module($module);
}
}

#
## Special hook for Params::Validate that is since recently... buggy - move to 
a perl only solution
#
my $validatedll = 

Re: mod_perl on win32

2009-08-25 Thread Jean-Damien Durand

Jean-Damien Durand a écrit :
Here is how I installed StrawberryPerl + mod_perl + apache2 on Windows 
(tested onVista):


Ah yes of course you will need to add lines like

LoadFile C:\strawberry\perl\bin\perl510.dll
LoadModule perl_module modules/mod_perl.so
LoadFile C:\Program Files\Apache Software 
Foundation\Apache2.2\bin\libapreq2.dll

LoadModule apreq_module modules/mod_apreq2.so

in your httpd.conf (change paths if needed)

Cheers, JD.




Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Fred Moyer
On Tue, Aug 25, 2009 at 12:05 PM, Igor Chudovichu...@gmail.com wrote:


 On Tue, Aug 25, 2009 at 12:16 PM, Fred Moyer f...@redhotpenguin.com wrote:

 One great tool that would help with the diagnosis is the very useful
 mp2bug, found in mod_perl-2.0/bin/mp2bug

 Can you run that from your mod_perl install and post the output?
 Version details are a huge clue in solving mysteries like this.


 Fred, thanks. here goes.


 -8-- Start Bug Report 8--
 1. Problem Description:

   [DESCRIBE THE PROBLEM HERE]

 2. Used Components and their Configuration:

 *** mod_perl version 2.03

Suggest trying 2.0.4.  If that still exhibits the problem, suggest
pulling a copy of subversion trunk and trying that.  I'm currently
running trunk on my servers (very stable).



 *** using /usr/lib/perl5/Apache2/BuildConfig.pm

 *** Makefile.PL options:
   MP_APR_LIB = aprext
   MP_APXS    = /usr/bin/apxs2
   MP_CCOPTS  = -g -Wall
   MP_COMPAT_1X   = 1
   MP_GENERATE_XS = 1
   MP_INCLUDE_DIR = /usr/include/apache2 /usr/include/apr-1.0
   MP_LIBNAME = mod_perl
   MP_TRACE   = 0
   MP_USE_DSO = 1
   MP_USE_GTOP    = 1
   MP_USE_STATIC  = 0


 *** The httpd binary was not found


 *** (apr|apu)-config linking info

 (apr|apu)-config scripts were not found



 *** /usr/bin/perl -V
 Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
   Platform:
     osname=linux, osvers=2.6.24-19-server,
 archname=i486-linux-gnu-thread-multi
     uname='linux palmer 2.6.24-19-server #1 smp sat jul 12 00:40:01 utc 2008
 i686 gnulinux '
     config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
 -Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr
 -Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8
 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5
 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.8
 -Dsitearch=/usr/local/lib/perl/5.8.8 -Dman1dir=/usr/share/man/man1
 -Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1
 -Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl
 -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm
 -Duseshrplib -Dlibperl=libperl.so.5.8.8 -Dd_dosuid -des'
     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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
 -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
 -D_FILE_OFFSET_BITS=64',
     optimize='-O2',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
 -fno-strict-aliasing -pipe -I/usr/local/include'
     ccversion='', gccversion='4.2.3 (Ubuntu 4.2.3-2ubuntu7)',
 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='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
     perllibs=-ldl -lm -lpthread -lc -lcrypt
     libc=/lib/libc-2.7.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8
     gnulibc_version='2.7'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


 Characteristics of this binary (from libperl):
   Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
     PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_ITHREADS
     USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
   Built under linux
   Compiled at Jan 14 2009 22:34:36
   %ENV:

 PERL5LIB=/home/ichudov/misc/life/modules:/home/ichudov/lisleelectric.com

 PERLLIB=/home/ichudov/misc/life/modules:/home/ichudov/lisleelectric.com
     PERL_LWP_USE_HTTP_10=1
   @INC:
     /home/ichudov/misc/life/modules
     /home/ichudov/lisleelectric.com
     /etc/perl
     /usr/local/lib/perl/5.8.8
     /usr/local/share/perl/5.8.8
     /usr/lib/perl5
     /usr/share/perl5
     /usr/lib/perl/5.8
     /usr/share/perl/5.8
     /usr/local/lib/site_perl
     .

 *** Packages of interest status:

 Apache2    : -
 Apache2::Request   : -
 CGI    : 3.15
 ExtUtils::MakeMaker: 6.30_01, 6.54
 LWP    : 5.808
 mod_perl   : -
 mod_perl2  : 2.03


 3. This is the core dump trace: (if you get a core dump):

   [CORE TRACE COMES HERE]

 This report was generated by /usr/share/libapache2-mod-perl2/mp2bug on Tue
 Aug 25 19:04:41 2009 GMT.

 -8-- End Bug Report --8--


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Fred Moyer
Igor,

Please cc the mod_perl list on all replies.  I'm available for
professional mod_perl consulting offlist, but I don't come cheap :)

On Tue, Aug 25, 2009 at 12:14 PM, Igor Chudovichu...@gmail.com wrote:


 On Tue, Aug 25, 2009 at 2:07 PM, Fred Moyer f...@redhotpenguin.com wrote:

  *** mod_perl version 2.03

 Suggest trying 2.0.4.  If that still exhibits the problem, suggest
 pulling a copy of subversion trunk and trying that.  I'm currently
 running trunk on my servers (very stable).

 Fred, I have not compiled mod_perl in ~4 years.

 What is the process  here, do I just download tarball and do configure and
 install? Is it any trickier?

http://perl.apache.org/docs/2.0/user/intro/start_fast.html

 The risks involved are kind of big here. So I want to be safe and have a
 good plan.

Suggest building this side by side with your existing installation.
Suggest testing this out first on your test environment.


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
Perrin, the pages are zero length. In my script that checks for this
condition, if I find trouble I save a few webpages to files.
(/, some other page and apache-status). The first two are zero length.

Igor


On Tue, Aug 25, 2009 at 12:14 PM, Perrin Harkins phark...@gmail.com wrote:

 On Tue, Aug 25, 2009 at 1:07 PM, Igor Chudovichu...@gmail.com wrote:
  Nothing much is in error_log, I do print some of my outputs, but nothing
 of
  interest.
 
  What I know is that I can retrieve www.algebra.com/apache-status, it
 works
  fine.
 
  However, retrieving mod_perl pages returns empty pages.

 If you mean that they don't render in the browser, it would help if
 you look at the content being sent instead.  It must be sending
 something, or you'd get a timeout error.

 - Perrin



Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
On Tue, Aug 25, 2009 at 12:16 PM, Fred Moyer f...@redhotpenguin.com wrote:

 One great tool that would help with the diagnosis is the very useful
 mp2bug, found in mod_perl-2.0/bin/mp2bug

 Can you run that from your mod_perl install and post the output?
 Version details are a huge clue in solving mysteries like this.


Fred, thanks. here goes.


-8-- Start Bug Report 8--
1. Problem Description:

  [DESCRIBE THE PROBLEM HERE]

2. Used Components and their Configuration:

*** mod_perl version 2.03

*** using /usr/lib/perl5/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB = aprext
  MP_APXS= /usr/bin/apxs2
  MP_CCOPTS  = -g -Wall
  MP_COMPAT_1X   = 1
  MP_GENERATE_XS = 1
  MP_INCLUDE_DIR = /usr/include/apache2 /usr/include/apr-1.0
  MP_LIBNAME = mod_perl
  MP_TRACE   = 0
  MP_USE_DSO = 1
  MP_USE_GTOP= 1
  MP_USE_STATIC  = 0


*** The httpd binary was not found


*** (apr|apu)-config linking info

(apr|apu)-config scripts were not found



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.24-19-server,
archname=i486-linux-gnu-thread-multi
uname='linux palmer 2.6.24-19-server #1 smp sat jul 12 00:40:01 utc 2008
i686 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN
-Dcccdlflags=-fPIC -Darchname=i486-linux-gnu -Dprefix=/usr
-Dprivlib=/usr/share/perl/5.8 -Darchlib=/usr/lib/perl/5.8
-Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5
-Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.8
-Dsitearch=/usr/local/lib/perl/5.8.8 -Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3 -Dsiteman1dir=/usr/local/man/man1
-Dsiteman3dir=/usr/local/man/man3 -Dman1ext=1 -Dman3ext=3perl
-Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Ud_ualarm -Uusesfio -Uusenm
-Duseshrplib -Dlibperl=libperl.so.5.8.8 -Dd_dosuid -des'
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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN
-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='4.2.3 (Ubuntu 4.2.3-2ubuntu7)',
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='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -lgdbm_compat -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=-ldl -lm -lpthread -lc -lcrypt
libc=/lib/libc-2.7.so, so=so, useshrplib=true, libperl=libperl.so.5.8.8
gnulibc_version='2.7'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP THREADS_HAVE_PIDS USE_ITHREADS
USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
  Built under linux
  Compiled at Jan 14 2009 22:34:36
  %ENV:
PERL5LIB=/home/ichudov/misc/life/modules:/home/ichudov/
lisleelectric.com
PERLLIB=/home/ichudov/misc/life/modules:/home/ichudov/lisleelectric.com

PERL_LWP_USE_HTTP_10=1
  @INC:
/home/ichudov/misc/life/modules
/home/ichudov/lisleelectric.com
/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
.

*** Packages of interest status:

Apache2: -
Apache2::Request   : -
CGI: 3.15
ExtUtils::MakeMaker: 6.30_01, 6.54
LWP: 5.808
mod_perl   : -
mod_perl2  : 2.03


3. This is the core dump trace: (if you get a core dump):

  [CORE TRACE COMES HERE]

This report was generated by /usr/share/libapache2-mod-perl2/mp2bug on Tue
Aug 25 19:04:41 2009 GMT.

-8-- End Bug Report --8--


portability of mod_perl for other web servers/apps

2009-08-25 Thread dbadhani

Hi Gurus,

I recently started exploring mod_perl, and am really impressed with the
flexibility this can provide for Apache. 

This may sound far fetched, but has anyone tried porting mod_perl for web
servers other than Apache.  I understand this is developed as a module for
Apache, and integrates tightly with it, after all its an Apache module. But
looking at the flexibility it offers, I was wondering if anyone thought of
extending it for other servers. 

Basically, I am looking for integrating some of mod_perl functionality in
some high performance middleware, basically to provide a way to customized,
scriptable request processing in the request processing engine.

Thanks,
Deven




-- 
View this message in context: 
http://www.nabble.com/portability-of-mod_perl-for-other-web-servers-apps-tp25140259p25140259.html
Sent from the mod_perl - General mailing list archive at Nabble.com.



Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
On Tue, Aug 25, 2009 at 2:24 PM, Fred Moyer f...@redhotpenguin.com wrote:

 Igor,

 Please cc the mod_perl list on all replies.  I'm available for
 professional mod_perl consulting offlist, but I don't come cheap :)


Sorry, I pressed a wrong button in GMail. :)



 On Tue, Aug 25, 2009 at 12:14 PM, Igor Chudovichu...@gmail.com wrote:
 
 
  On Tue, Aug 25, 2009 at 2:07 PM, Fred Moyer f...@redhotpenguin.com
 wrote:
 
   *** mod_perl version 2.03
 
  Suggest trying 2.0.4.  If that still exhibits the problem, suggest
  pulling a copy of subversion trunk and trying that.  I'm currently
  running trunk on my servers (very stable).
 
  Fred, I have not compiled mod_perl in ~4 years.
 
  What is the process  here, do I just download tarball and do configure
 and
  install? Is it any trickier?

 http://perl.apache.org/docs/2.0/user/intro/start_fast.html

  The risks involved are kind of big here. So I want to be safe and have a
  good plan.

 Suggest building this side by side with your existing installation.
 Suggest testing this out first on your test environment.


OK, I did build it, it was nice.

My plan is to:

1) Remove ubuntu mod_perl package
2) Do make install
3) test

If test succeeds, I will stop. If test fails, I would reinstall the system
mod_perl.

Is that a safe plan?

Thank you.

Igor


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Fred Moyer
On Tue, Aug 25, 2009 at 1:07 PM, Igor Chudovichu...@gmail.com wrote:
  The risks involved are kind of big here. So I want to be safe and have a
  good plan.

 Suggest building this side by side with your existing installation.
 Suggest testing this out first on your test environment.

 OK, I did build it, it was nice.

 My plan is to:

 1) Remove ubuntu mod_perl package
 2) Do make install
 3) test

 If test succeeds, I will stop. If test fails, I would reinstall the system
 mod_perl.

 Is that a safe plan?

I'd try this on a test server first (which ideally is a replicate of
your production environment.

Best thing to do is have a rollback plan IMHO.


Re: At random moments, mod_perl starts returning empty pages

2009-08-25 Thread Igor Chudov
On Tue, Aug 25, 2009 at 8:50 PM, Fred Moyer f...@redhotpenguin.com wrote:


  My plan is to:
 
  1) Remove ubuntu mod_perl package
  2) Do make install
  3) test
 
  If test succeeds, I will stop. If test fails, I would reinstall the
 system
  mod_perl.
 
  Is that a safe plan?

 I'd try this on a test server first (which ideally is a replicate of
 your production environment.

 Best thing to do is have a rollback plan IMHO.


Yes, the above was what I would consider a rollback plan.

I will indeed try it first on a non-production server.

I have some news regarding this that I will post in a separate message.


News regarding mod_perl returning empty pages

2009-08-25 Thread Igor Chudov
I have an update on this story.

I set up a shell script that would notice this condition (empty pages
returned) and alert me immediately via wall within 10 seconds.

So I caught this in progress, before my 5 minute restarter would intervene,
and experimented quickly.

As I mentioned before, I have perlbal running in front on port 80, with
apache listening on localhost port 10080 and serving perlbal.

Since we discussed perlbal, I tried to access
http://localhost.algebra.com:10080/ instead of www.algebra.com. (
localhost.algebra.com resolves to 127.0.0.1 and is an alias for
www.algebra.com).

Results were materially different: instead of 100% failures that I had with
perlbal, I would only fail one out of many times.

The failure became intermittent instead of constant.

I believe that I have an explanation: only one worker happens to be messed
up. When I access apache directly, I would connect to a random worker, so my
failure would be intermittent. However, perlbal was set (in perlbal.conf) to
maintain persistent connection, so it would mostly bang on one worker
instead of randomly hitting them.

As a result, with perlbal, if that worker goes bad, then the whole website
is consistently not working.

In other words, perlbal is not the issue, as such, but it exacerbated the
problem due to the way I set it up.

I changed perlbal.conf to set persist_backend = off, which, I hope, will
have an effect of perlbal creating a separate connection for every request.
Should not have much effect, speed wise, since everything runs on localhost,
I hope.

My new perlbal.conf is included:

REATE POOL dynamic
  pool dynamic add 127.0.0.1:10080

CREATE SERVICE balancer
  SET listen   = 0.0.0.0:80
  SET role = reverse_proxy
  SET pool = dynamic
  SET persist_client  = on
  SET persist_backend = off
  SET verify_backend  = on
ENABLE balancer

# always good to keep an internal management port open:
CREATE SERVICE mgmt
  SET role   = management
  SET listen = 127.0.0.1:6
ENABLE mgmt