Helping with mod_perl

2012-09-06 Thread Andy Colson

Hi all.  I have a production site running mod_perl, and I'd like to make sure 
mod_perl continues into Apache 2.4.  To that end, I'm wondering if there is 
anything I can do to help.

My perl-foo is much stronger than my C-foo, and I have no experience with xs or 
apache internals.

-Andy


Re: Error on install of mod_perl2: Cannot load mod_perl.so into server: Symbol not found: _modperl_handler_name

2012-09-10 Thread Andy Colson

On 9/10/2012 7:53 AM, Faith Bazley wrote:

Hi,

I'm having trouble installing mod_perl-2.0.7 and for the life of me I
can't get it to work. I have had no problems installing other modules.

 From the source directory /usr/local/src, unpack the mod_perl-2.0.7
source, enter the directory and run the following

perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs

then "make"
then "make test", which is where I am getting the error below. Some kind
of syntax error. Please help.


/usr/local/apache2/bin/httpd  -d /usr/local/src/mod_perl-2.0.7/t -f
/usr/local/src/mod_perl-2.0.7/t/conf/httpd.conf -D APACHE2
using Apache/2.2.22 (prefork MPM)

waiting 120 seconds for server to start: .[Mon Sep 10 20:16:25 2012]
[warn] module apreq_module is already loaded, skipping
*httpd: Syntax error on line 22 of
/usr/local/src/mod_perl-2.0.7/t/conf/httpd.conf: Cannot load
/usr/local/src/mod_perl-2.0.7/src/modules/perl/mod_perl.so into server:
dlopen(/usr/local/src/mod_perl-2.0.7/src/modules/perl/mod_perl.so, 10):
Symbol not found: _modperl_handler_name\n  Referenced from:
/usr/local/src/mod_perl-2.0.7/src/modules/perl/mod_perl.so\n  Expected
in: dynamic lookup\n*

*** /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 16 subversion 1) configuration:
   Platform:
 osname=darwin, osvers=11.4.0, archname=darwin-2level
 uname='darwin faiths-macbook-pro.local 11.4.0 darwin kernel version
11.4.0: mon apr 9 19:32:15 pdt 2012; root:xnu-1699.26.8~1release_x86_64



Yeah.. I can't get mod_perl to work with 5.16.1 either.  The release 
notes said 5.16... but I'm betting 5.16.1 broke something.


-Andy



Re: Error on install of mod_perl2: Cannot load mod_perl.so into server: Symbol not found: _modperl_handler_name

2012-09-10 Thread Andy Colson

On 9/10/2012 7:53 AM, Faith Bazley wrote:

Hi,

I'm having trouble installing mod_perl-2.0.7 and for the life of me I
can't get it to work. I have had no problems installing other modules.

 From the source directory /usr/local/src, unpack the mod_perl-2.0.7
source, enter the directory and run the following

perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs

then "make"
then "make test", which is where I am getting the error below. Some kind
of syntax error. Please help.


/usr/local/apache2/bin/httpd  -d /usr/local/src/mod_perl-2.0.7/t -f
/usr/local/src/mod_perl-2.0.7/t/conf/httpd.conf -D APACHE2
using Apache/2.2.22 (prefork MPM)

waiting 120 seconds for server to start: .[Mon Sep 10 20:16:25 2012]
[warn] module apreq_module is already loaded, skipping
*httpd: Syntax error on line 22 of
/usr/local/src/mod_perl-2.0.7/t/conf/httpd.conf: Cannot load
/usr/local/src/mod_perl-2.0.7/src/modules/perl/mod_perl.so into server:
dlopen(/usr/local/src/mod_perl-2.0.7/src/modules/perl/mod_perl.so, 10):
Symbol not found: _modperl_handler_name\n  Referenced from:
/usr/local/src/mod_perl-2.0.7/src/modules/perl/mod_perl.so\n  Expected
in: dynamic lookup\n*

*** /usr/local/bin/perl -V
Summary of my perl5 (revision 5 version 16 subversion 1) configuration:
   Platform:
 osname=darwin, osvers=11.4.0, archname=darwin-2level
 uname='darwin faiths-macbook-pro.local 11.4.0 darwin kernel version
11.4.0: mon apr 9 19:32:15 pdt 2012; root:xnu-1699.26.8~1release_x86_64



Yeah.. I can't get mod_perl to work with 5.16.1 either.  The release
notes said 5.16... but I'm betting 5.16.1 broke something.

-Andy



On 9/10/2012 10:00 AM, Doug Hunt wrote:> Hi Andy:  I just got a dynamic 
mod_perl to build (and work properly)

> under Linux:
>
> perl 5.16.1
> mod_perl 2.0.8
> apache 2.2.22
>
> So I don't think that perl 5.16.X broke all mod_perl builds.
>
> Regards,
>
>Doug Hunt
>
> dh...@ucar.edu
> Software Engineer
> UCAR - COSMIC, Tel. (303) 497-2611
>
> On Mon, 10 Sep 2012, Andy Colson wrote:
>


2.0.8?  Is that in subversion?  I'll check it out and give it a try.

-Andy




Re: Error on install of mod_perl2: Cannot load mod_perl.so into server: Symbol not found: _modperl_handler_name

2012-09-10 Thread Andy Colson

On 9/10/2012 10:16 AM, Doug Hunt wrote:

Hi Andy:  Right.  We were working with the mod_perl from subversion.

--Doug



Humm.. no, that didn't quite work.

make test gives me a bunch of stuff like:

ulimit -c unlimited; /usr/bin/perl5.16.1 /pub/apps/mod_perl-2.0/t/TEST 
-bugreport -verbose=0

Not a CODE reference at /usr/lib/perl5/DynaLoader.pm line 213.
END failed--call queue aborted at 
/pub/apps/mod_perl-2.0/blib/lib/ModPerl/Const.pm line 213.
Compilation failed in require at 
/pub/apps/mod_perl-2.0/blib/lib/Apache2/Const.pm line 18.
BEGIN failed--compilation aborted at 
/pub/apps/mod_perl-2.0/blib/lib/Apache2/Const.pm line 18.
Compilation failed in require at 
/pub/apps/mod_perl-2.0/t/response/TestApache/subprocess.pm line 13.



And then:

/usr/sbin/httpd  -d /pub/apps/mod_perl-2.0/t -f 
/pub/apps/mod_perl-2.0/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS

using Apache/2.2.22 (prefork MPM)

waiting 120 seconds for server to start: .[Mon Sep 10 10:31:20 2012] 
[warn] PassEnv variable LD_LIBRARY_PATH was undefined

[  error] oh darn, server dumped core
[  error] for stacktrace, run: gdb /usr/sbin/httpd -core 
/pub/apps/mod_perl-2.0/core

[  error]
server has died with status 255 (t/logs/error_log wasn't created, start 
the server in the debug mode)

[  error] oh shucks, server dumped core
[  error] for stacktrace, run: gdb /usr/sbin/httpd -core 
/pub/apps/mod_perl-2.0/core
sh: line 1: 23479 Terminated  /usr/bin/perl5.16.1 
/pub/apps/mod_perl-2.0/t/TEST -bugreport -verbose=0

make: *** [run_tests] Error 143



But..  I had to down grade my apache from 2.4 to 2.2.22, but I left the 
apr alone.  I have apr-1.4.6, and apr-util-1.4.1.  (I'm running 
Slackware 14).  Think the apr version would make a difference?


-Andy


Re: mod_perl build with perlbrew

2012-09-19 Thread Andy Colson

On 9/19/2012 2:43 PM, bluedome wrote:



I'm building mod_perl with a perl built using perlbrew.

The build succeeds but make test fails because @INC is not correct.

@INC for the perlbrew-built perl is:

   @INC:

/opt/comms/be/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux
 /opt/comms/be/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0
 /opt/comms/be/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/x86_64-linux
 /opt/comms/be/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0

I built mod_perl with this perl, so it seems like it should keep this in
INC, but it doesn't.  When I run
apache the INC is:

/usr/sbin/httpd  -d /opt/comms/be/code/apache_extensions/mod_perl-2.0.7/t -f
/opt/comms/be/code/apache_extensions/mod_perl-2.0.7/t/conf/httpd.conf -D
APACHE2
using Apache/2.2.15 (prefork MPM)

waiting 120 seconds for server to start: .Can't locate lib.pm in @INC (@INC
contains:
/opt/comms/be/code/apache_extensions/mod_perl-2.0.7/t/htdocs/testdirective/main
/opt/comms/be/code/apache_extensions/mod_perl-2.0.7/t/htdocs/testdirective/perlmodule-vh
/usr/lib/site_perl/5.16.0/x86_64-linux /usr/lib/site_perl/5.16.0
/usr/lib/5.16.0/x86_64-linux /usr/lib/5.16.0).

I have tried modifying the INC setting during the mod_perl build by using a
command of the form:

perl Makefile.PL MP_APXS=/usr/sbin/apxs INC="-I -I..."

and also I've tried setting LD_LIBRARY_PATH environment variable to those
paths when running httpd, and still getting this error.

My questions are:

1. why does mod_perl lose the INC that is required to run the perl that it
is built with?
2. what do I try next?

Thanks



Maybe setting @INC in apache.conf?

add:

PerlSwitches -I 
"/opt/comms/be/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0/x86_64-linux"


PerlSwitches -I 
"/opt/comms/be/perl5/perlbrew/perls/perl-5.16.0/lib/site_perl/5.16.0"


etc...


its not perfect... but maybe?

-Andy






Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

2012-09-28 Thread Andy Colson


On 09/28/2012 08:07 AM, Stefan Profanter wrote:

Hi!

Posted this question already on Catalyst Mailing List, but got no answer yet 
and I think this problem is caused by mod_perl somewhere.

I programmed a Catalyst Application which uses mod_perl and apache2 in 
production mode.

The Catalyst App runs fine in debug mode (“Started with own script on port 
3000”).

Another Catalyst application programmed some months ago works perfect with 
nearly the same configuration and runs also parallel even on the same apache2 
(also with same Session Plugins).

The first time, I access the site everything works fine. But after login, only 
the first page opens, each second try to open another page results in a 
Segmentation Fault. Even pages which don’t require login.

If I then disable or delete the Cookies, the Site works again. So my guess is 
that there is somewhere a problem with Session handling.

Disabling the first application in apache doesn’t change anything.

Can you help me finding out what causes the SegFault (Debug infos see above)?

Thanks a lot!!!

Stefan

--

Here ist the backtrace from gdb and apache2 which I got so far:

Core was generated by `/usr/sbin/apache2 -k start'.

Program terminated with signal 11, Segmentation fault.

#0  mbuf2sv (my_perl=0x2b60a36b94c0, f=, sv=, optype=,

 network_order=-1547829216, res=) at Storable.xs:3873

3873return newSVpv(mbase, MBUF_SIZE());

(gdb) bt

#0  mbuf2sv (my_perl=0x2b60a36b94c0, f=, sv=, optype=,

 network_order=-1547829216, res=) at Storable.xs:3873

#1  do_store (my_perl=0x2b60a36b94c0, f=, sv=, optype=,

 network_order=-1547829216, res=) at Storable.xs:3833

#2  0x2b608bf0856b in XS_Storable_mstore (my_perl=0x2b60a36b94c0, cv=) at Storable.xs:6427

#3  0x2b6085e54045 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10




Looks like you are using Storable to stream out cookies?  Looks like something 
in there is causing Storable to puke.  I see things like array_call, 
store_blessed, store_hash... So I'm guessing your passing Storable some kind of 
object?  Does it have any recursive parts?

I googled "perl storable seg fault" and it looks like people have gotten 
Storable to seg fault before.  I'm not sure if the stack trace is reading objects or 
writing them.  Maybe you can glean from other's what makes Storable segfault.

First figure out if its reading or writing that causes the problem, then try to 
figure out what part of the object is so upsetting.


3873return newSVpv(mbase, MBUF_SIZE());


Hum... any chance that is really really big?

-Andy





Re: reloading perl modules under heavy load

2012-10-03 Thread Andy Colson

On 10/3/2012 8:45 AM, Jason Aubrey wrote:

Hi All,

We have  modperl application running on 64bit (2 cores), freebsd 8.2,
perl 1.14.1, modperl 2.0.5, apache 2.2.21, 24GB of ram and about 5.5k
users. Additional system details are below.  Under heavy load we are
seeing errors of the form

Failed to evaluate module Parser::Legacy: Attempt to reload
Parser/Legacy.pm aborted.\nCompilation failed in require at (eval
15635) line 1


I vaguely suspect this is a concurrency issue.  Requests that generate
such errors often, but not always, call to GD.pm to build dynamically
generated images.  The errors often, but not always, refer to
Parser::Legacy a module which is part of our application, but I think
this is a red-herring since it only occurs under load, and I've seen
such errors refer to other modules, for example DateTime.

My server is the largest production freebsd machine running this
application; most servers of this size run Red Hat or Ubuntu and as far
as I can tell nobody has seen this error before.

I honestly have no idea if this is a modperl issue, an apache issue, a
freebsd issue, etc. But I thought I would start here since this is where
the rubber (requests) meet the road (perl).  Has anyone see such an
error before? Or know of a similar case that might give me some
additional clues?

Thanks very much,
Jason Aubrey




Are you including Apache2::Reload anyplace?  I use it on my dev box and 
get messages like that quite often.  I don't use it on my production 
box.  To update production, I 'svn up; apache restart' sort of thing.


-Andy



Re: handler dir

2012-10-24 Thread Andy Colson

On 10/24/2012 3:31 AM, pangj wrote:

Hello,

I have setup a handler under the root dir, i.e, http://example.com/
Can I setup another handler under the sub-path of root dir, for example,
http://example.com/path/  ?

Thank you.


Yeah, I believe you can.  I have a setup like this, inside a :


PerlModule Quote

PerlSetupEnv Off
SetHandler modperl
PerlResponseHandler Quote
Order allow,deny
Allow from all



SetHandler default-handler
Allow from all



SetHandler default-handler
Allow from all


Alias /quote/css /pub/www/quote/css
Alias /quote/js /pub/www/quote/js


In this case I'm resetting to the default-handler, but I don't see why 
you couldn't set it to another perl handler.


-Andy


Re: ModPerl::Util::exit: (120000) exit was called at /usr/share/perl5/CGI/Carp.pm line 590

2012-10-31 Thread Andy Colson

On 10/31/2012 11:57 AM, Dave Morgan wrote:

Hi All.
 We moved our software stack to mod-perl2 six months ago and
have been steadily cleaning up warnings and such. We have had
problems with warning messages from regex's showing up without
time information. The following issue appears similar.

How do I find out where the following call(s) are made from?

We are trying to remove all references to Carp from our code
but that still leaves how many libraries?

 From my error log:

[Tue Oct 30 04:40:14 2012] [error] [client 184.22.183.114] File does not
exist: /home/apache/metapoint/be/html/8153.html


I don't think this is a mod_perl message.  I'd bet its an apache 
message.  Do you use something like FireBug's net panel to watch all the 
different requests?  I'll bet one of the requests if for 8153.html, and 
I'll bet it's getting a 404 not found.





ModPerl::Util::exit: (12) exit was called at
/usr/share/perl5/CGI/Carp.pm line 590
ModPerl::Util::exit: (12) exit was called at
/usr/share/perl5/CGI/Carp.pm line 590
ModPerl::Util::exit: (12) exit was called at
/usr/share/perl5/CGI/Carp.pm line 590
ModPerl::Util::exit: (12) exit was called at
/usr/share/perl5/CGI/Carp.pm line 590


In mod_perl, you should not be using exit.  ModPerl::Util::exit is a 
replacement exit to make it a little less worse.  In reality, I'd think 
you'd want to find every instance of the word 'exit' and fix it.






[Tue Oct 30 04:59:51 2012] -e: Use of uninitialized value $id in
concatenation (.) or string at
/home/apache/metapoint/trunk/Metadot/GizmoBase.pm line 632.




I'd check GizmoBase.pm at line 632.

-Andy



Re: alias command in modperl environment

2012-12-19 Thread Andy Colson

On 12/19/2012 2:40 AM, Feng He wrote:

Hello,


 ServerAdmin x...@yyy.com
 ServerName example.com

 PerlModule Apache::DBI
 PerlPostConfigRequire /path/to/startup.pl

 
 SetHandler modperl
 PerlResponseHandler Handler1
 

 
 SetHandler modperl
 PerlResponseHandler Handler2
 

 Alias /zzz/ "/var/www/zzz/"
 
 Options FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
 

 ErrorLog /var/log/apache2/error.log
 LogLevel warn
 CustomLog /var/log/apache2/cdn.access.log combined




I put some static files under /var/www/zzz/.
When accessing these static files, I got 403 error.
Can't alias command work for this case?

Thanks.


Here is an apache config I use that works:

PerlSwitches -I "/pub/www/world"
PerlModule World


PerlSetupEnv Off
SetHandler modperl
PerlResponseHandler World
Order allow,deny
Allow from all



SetHandler default-handler
Allow from all



SetHandler default-handler
Allow from all


Alias /world/css /pub/www/world/css
Alias /world/js /pub/www/world/js


-Andy


Re: MP and 2.4 Compilation Woes

2013-02-08 Thread Andy Colson

On 2/8/2013 9:39 AM, Kevin A. McGrail wrote:

Hi All,

So picking back up on the thread from the httpd list, I am interested in
helping with mod_perl.  And I've written some patches for AuthenDBI and
can work on those again as well.

However, at the moment I can't compile 2.4 and the make source_scan
stuff is not something I even understand nor can I find much documented
about it.

I've worked through Jan's patches downloaded 9/25 and the info on
http://qteajs.org/howto/apache?_size=1920x1086 looked promising.

And even though I'm also using my own custom built perl 5.14 instead of
the RH/CentOS builds I've tried so far, I've had no luck.

Following Jan's advice, I had to add this to ParseSource.pm

+ 'APACHE_HTTP_VHOST_H', #c-scan chokes on http_host.h
+ 'H_PERL', #""

That got me this far...

/usr/local/perl-5.14/bin/perl build/source_scan.pl
Expecting parenth after identifier in `const XML_Memory_Handling_Suite
*memsuite'
after `const XML_Memory_Handling_Suite ' at lib/ModPerl/CScan.pm line 895.
make: *** [source_scan] Error 255

Overall, I think the concept that things should be forked to a new 2.4
mod_perl is best because if it's backwards compatibility that's holding
things back, I'd rather lose that.  I'm currently building on a devel
box running on CentOS 6.2.

Regards,
KAM



> /usr/local/perl-5.14/bin/perl build/source_scan.pl

Have you tried:

make source_scan
make xs_generate

-Andy



Re: MP and 2.4 Compilation Woes

2013-02-08 Thread Andy Colson

On 2/8/2013 9:55 AM, Kevin A. McGrail wrote:

On 2/8/2013 10:48 AM, Andy Colson wrote:

On 2/8/2013 9:39 AM, Kevin A. McGrail wrote:

Hi All,




> /usr/local/perl-5.14/bin/perl build/source_scan.pl

Have you tried:

make source_scan

Yes.  That info above is the output from the end of make source_scan
with Jan's patches, the extra patch I did similar to the 0027 patch of
his and I think some minor patches from the qteajs.  I am stuck at this
step.


make xs_generate

-Andy




ah, sorry.  I thought you had typed:

>> > /usr/local/perl-5.14/bin/perl build/source_scan.pl

Do you have multiple perl's installed?  /usr/local/perl-5.14 seems 
unusual.  Any chance your picking up headers or libs from a different 
version of perl?


-Andy



Re: MP and 2.4 Compilation Woes

2013-02-08 Thread Andy Colson

On 2/8/2013 10:09 AM, Kevin A. McGrail wrote:

On 2/8/2013 11:04 AM, Kevin A. McGrail wrote:

On 2/8/2013 11:01 AM, Andy Colson wrote:

thought you had typed:

>> > /usr/local/perl-5.14/bin/perl build/source_scan.pl

Do you have multiple perl's installed?  /usr/local/perl-5.14 seems
unusual.

I custom compiled a version of perl in /usr/local/perl-5.14

Any chance your picking up headers or libs from a different version
of perl?

Always feasible but I only added that version of perl because things
were worse with perl 5.10.1 from the RH/CentOS RPMs.

I should be cleared. I don't know if it's picking up other headers/libs,
etc.  I'm happy to look if you can give me a pointer in the right
direction and/or post output logs, etc.  At this point, I've been trying
to compile mp 2.4 and reading source for several few months with about 4
hours a week on this.  I've tried a LOT of different things and I can
try more including different boxes, reloading fresh OSes, etc.


Here's how I did it.

tar xf mod_perl-2.0-current.tar.gz
cp all.tgz mod_perl-2.0.7/
cd mod_perl-2.0.7/
tar xf all.tgz
for i in *.patch; do patch -p1 < $i; done
perl Makefile.PL MP_APR_CONFIG=/usr/bin/apr-1-config
make source_scan

Some output from make source_scan:
$ make source_scan
/usr/bin/perl build/source_scan.pl
In file included from .apache_includes:161:0,
 from :1:
/pub/apps/mod_perl-2.0.7/xs/modperl_xs_sv_convert.h:146:0: warning: 
"mp_xs_sv2_APR__Table" redefined [enabled by default]

In file included from .apache_includes:160:0,
 from :1:
... bunch more like this ...
... finishes ok ..

Your error "Expecting parenth after identifier" looks like an h2xs 
error.  I'll look around a little more.


-Andy







Re: MP and 2.4 Compilation Woes

2013-02-08 Thread Andy Colson

On 2/8/2013 10:30 AM, Andy Colson wrote:

On 2/8/2013 10:09 AM, Kevin A. McGrail wrote:

On 2/8/2013 11:04 AM, Kevin A. McGrail wrote:

On 2/8/2013 11:01 AM, Andy Colson wrote:

thought you had typed:

>> > /usr/local/perl-5.14/bin/perl build/source_scan.pl

Do you have multiple perl's installed?  /usr/local/perl-5.14 seems
unusual.

I custom compiled a version of perl in /usr/local/perl-5.14

Any chance your picking up headers or libs from a different version
of perl?

Always feasible but I only added that version of perl because things
were worse with perl 5.10.1 from the RH/CentOS RPMs.

I should be cleared. I don't know if it's picking up other headers/libs,
etc.  I'm happy to look if you can give me a pointer in the right
direction and/or post output logs, etc.  At this point, I've been trying
to compile mp 2.4 and reading source for several few months with about 4
hours a week on this.  I've tried a LOT of different things and I can
try more including different boxes, reloading fresh OSes, etc.


Here's how I did it.

tar xf mod_perl-2.0-current.tar.gz
cp all.tgz mod_perl-2.0.7/
cd mod_perl-2.0.7/
tar xf all.tgz
for i in *.patch; do patch -p1 < $i; done
perl Makefile.PL MP_APR_CONFIG=/usr/bin/apr-1-config
make source_scan

Some output from make source_scan:
$ make source_scan
/usr/bin/perl build/source_scan.pl
In file included from .apache_includes:161:0,
  from :1:
/pub/apps/mod_perl-2.0.7/xs/modperl_xs_sv_convert.h:146:0: warning:
"mp_xs_sv2_APR__Table" redefined [enabled by default]
In file included from .apache_includes:160:0,
  from :1:
... bunch more like this ...
... finishes ok ..

Your error "Expecting parenth after identifier" looks like an h2xs
error.  I'll look around a little more.

-Andy







XML_Memory_Handling_Suite is from expat.  I have 2.0.1 installed.  Do 
you have the expat-dev package installed?


-Andy


Re: MP and 2.4 Compilation Woes

2013-02-08 Thread Andy Colson

On 2/8/2013 11:01 AM, Kevin A. McGrail wrote:

On 2/8/2013 11:33 AM, Andy Colson wrote:

XML_Memory_Handling_Suite is from expat.  I have 2.0.1 installed.  Do
you have the expat-dev package installed?

I did not, I do now, no apparent change.

Regards,
KAM


Maybe there are other dev packages?  apr-dev?  perl-dev?  I use 
slackware so I don't know what packages you need.


-Andy


Re: About config file

2013-03-07 Thread Andy Colson

On 3/6/2013 9:00 PM, Ken Peng wrote:

Hello,

How do you setup config file in modperl web development?
I currently use the style like a package:

package Myconfig;

sub new {
 my $class = shift;
 my $option = { key1 => 'foo', key2 => 'bar', ... };
 bless $option,$class;
}

1;


Then in the modperl program:

use Myconfig;

my $conf = Myconfig->new;
my $opt1 = $conf->{key1};
my $opt2 = $conf->{key2};
...


I don't know if this is a good way. Do you have suggestions?

Thanks.


Here's how I do it.


use Config::General qw(ParseConfig);
use constant CONFIG => '/pub/maps/maps.conf';
my $cfgstamp;  # when config timestamp changes, reload
reloadConfig();

sub reloadConfig
{
my $x = (stat(CONFIG))[9];
if ($x != $cfgstamp)
{
%config = ParseConfig( -ConfigFile => CONFIG);
$cfgstamp = $x;
my $h = hostname;
#print STDERR "reloadConfig: host = $h\n";
if (exists($config{$h}->{debug}))
{
$config{debug} = $config{$h}->{debug};
}
if (exists($config{$h}->{reload}))
{
$config{reload} = $config{$h}->{reload};
}
if (exists($config{$h}->{persistdb}))
{
$config{persistdb} = $config{$h}->{persistdb};
}


if ($config{persistdb})
{
opendb();
}
}
}


sub handler
{
$web = AWeb->new(shift);
if ($config{updating})
{
$web->content_type("text/plain");
$web->print("The maps are being updated and should be back 
soon");
reloadConfig();
return Apache2::Const::OK;
}
... etc, etc,

... then finally
if ($config{reload})
{
reloadConfig();
}
if (not $config{persistdb})
{
closedb();
}
return Apache2::Const::OK;
}




Re: Detection "connection reset by peer" in mod_perl before send a response

2013-08-10 Thread Andy Colson

On 08/10/2013 06:54 AM, Lucas wrote:

Dear all.

I need to detect that user pressed escape, apache receives it like "connection reset 
by peer" (I saw it with truss, freebsd strace), before my script will send a 
response to client.

I can explain: my script works some time (about 2-3 sec), it gathers some data. 
Within this period it is possible that user decide to press escape or even to 
close the page or browser.

I need to detect it and clean some temporary files, what is normally happen by 
additional request from script on the page.

I need your advice how to do it.

Thanks.


I wrap an eval around it and ignore the error:

eval {
  $r->print($buf);
};

unlink($tempfiles);

-Andy



Re: support for Apache 2.4

2014-02-15 Thread Andy Colson

On 02/15/2014 08:48 AM, Perrin Harkins wrote:

On Fri, Feb 14, 2014 at 8:01 PM, Jie Gao  wrote:

The link http://svn.apache.org/snapshots/modperl-2.0/ on page
http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution
returns 404; http://perl.apache.org/dist/ is full of broken links.


Apologies for the disruptions on the site.  We have had to make some
changes in how it is generated in order to catch up to current Apache
policies, and that has exposed some parts of the site generation
process that were only understood by developers who are no longer
around.  We're working on it.

- Perrin



Once again, I'd like to offer any help I can provide.

-Andy


Re: support for Apache 2.4

2014-02-20 Thread Andy Colson

On 02/16/2014 09:36 AM, Steve Hay wrote:

On 16 February 2014 15:11, Dominic Hargreaves  wrote:

On Sun, Feb 16, 2014 at 11:10:20PM +1100, Carl Brewer wrote:

Having just downloaded this latest SVN repo, a grep for "2.4" in the
root dir shows a couple of changes, but no explicit mention of 2.4
support.

Before I try it, does it actually support 2.4 yet?


The Debian project is shipping mod_perl with httpd24 support
based on http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24/.
This appears to be good enough for our needs, so you might like to give
it a try (our packages are based on a somewhat older version of that
branch, and there seem to be quite a number of changes going in, so
it's worth giving that a go. I haven't heard about any current plans for
merging this to trunk, though.



An update on the state of things regarding httpd-2.4 support in mod_perl:

We are working hard to get this done and are 99% of the way there.
Both volunteers and volunteers' time is limited, though, so progress
has been slow. A lot of work has taken place in the httpd24 branch,
and as Dominic says, some Linux distros are already shipping that.

Further improvements to mod_perl have also been made in the threading
branch, and in a bid to improve the state of httpd-2.4 support on
Windows I recently merged the two together in a new branch called
httpd24threading. This is where current development activity is taking
place, and we are now sufficiently close that I expect this to be
merged back to trunk soon.



I'm on Slackware64 14.1.
svn co http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24threading/ 
mod_perl
cd mod_perl
perl Makefile.PL
... seemed ok ...
make
... seed ok...
make test

make[1]: Leaving directory `/pub/apps/mod_perl/xs'
/usr/bin/perl5.18.1 -Iblib/arch -Iblib/lib \
t/TEST -clean
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST -clean
APACHE_TEST_GROUP= APACHE_TEST_APXS= APACHE_TEST_HTTPD= APACHE_TEST_USER= 
APACHE_TEST_PORT= \
/usr/bin/perl5.18.1 -Iblib/arch -Iblib/lib \
t/TEST -bugreport -verbose=0
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST -bugreport 
-verbose=0
/usr/sbin/httpd  -d /pub/apps/mod_perl/t -f 
/pub/apps/mod_perl/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.4.6 (event MPM)

waiting 300 seconds for server to start: .httpd: Syntax error on line 97 of 
/pub/apps/mod_perl/t/conf/httpd.conf: Cannot load 
/usr/lib64/httpd/modules/mod_apreq2.so into server: 
/usr/lib64/httpd/modules/mod_apreq2.so: undefined symbol: ap_log_error
[  error]
server has died with status 255 (t/logs/error_log wasn't created, start the 
server in the debug mode)
sh: line 1:  1523 Terminated  /usr/bin/perl5.18.1 
/pub/apps/mod_perl/t/TEST -bugreport -verbose=0
make: *** [run_tests] Error 143

Any hints?

-Andy



Re: support for Apache 2.4

2014-02-20 Thread Andy Colson

On 02/20/2014 02:53 PM, Jeff Trawick wrote:

On Thu, Feb 20, 2014 at 3:49 PM, Andy Colson mailto:a...@squeakycode.net>> wrote:

On 02/16/2014 09:36 AM, Steve Hay wrote:

On 16 February 2014 15:11, Dominic Hargreaves mailto:d...@earth.li>> wrote:

On Sun, Feb 16, 2014 at 11:10:20PM +1100, Carl Brewer wrote:

Having just downloaded this latest SVN repo, a grep for "2.4" 
in the
root dir shows a couple of changes, but no explicit mention of 
2.4
support.

Before I try it, does it actually support 2.4 yet?


The Debian project is shipping mod_perl with httpd24 support
based on 
http://svn.apache.org/repos/__asf/perl/modperl/branches/__httpd24/ 
<http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24/>.
This appears to be good enough for our needs, so you might like to 
give
it a try (our packages are based on a somewhat older version of that
branch, and there seem to be quite a number of changes going in, so
it's worth giving that a go. I haven't heard about any current 
plans for
merging this to trunk, though.


An update on the state of things regarding httpd-2.4 support in 
mod_perl:

We are working hard to get this done and are 99% of the way there.
Both volunteers and volunteers' time is limited, though, so progress
has been slow. A lot of work has taken place in the httpd24 branch,
and as Dominic says, some Linux distros are already shipping that.

Further improvements to mod_perl have also been made in the threading
branch, and in a bid to improve the state of httpd-2.4 support on
Windows I recently merged the two together in a new branch called
httpd24threading. This is where current development activity is taking
place, and we are now sufficiently close that I expect this to be
merged back to trunk soon.


I'm on Slackware64 14.1.
svn co 
http://svn.apache.org/repos/__asf/perl/modperl/branches/__httpd24threading/ 
<http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24threading/> 
mod_perl
cd mod_perl
perl Makefile.PL
... seemed ok ...
make
... seed ok...
make test

make[1]: Leaving directory `/pub/apps/mod_perl/xs'
/usr/bin/perl5.18.1 -Iblib/arch -Iblib/lib \
t/TEST -clean
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST -clean
APACHE_TEST_GROUP= APACHE_TEST_APXS= APACHE_TEST_HTTPD= APACHE_TEST_USER= 
APACHE_TEST_PORT= \
/usr/bin/perl5.18.1 -Iblib/arch -Iblib/lib \
t/TEST -bugreport -verbose=0
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST 
-bugreport -verbose=0
/usr/sbin/httpd  -d /pub/apps/mod_perl/t -f 
/pub/apps/mod_perl/t/conf/__httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.4.6 (event MPM)

waiting 300 seconds for server to start: .httpd: Syntax error on line 97 of 
/pub/apps/mod_perl/t/conf/__httpd.conf: Cannot load 
/usr/lib64/httpd/modules/mod___apreq2.so into server: 
/usr/lib64/httpd/modules/mod___apreq2.so: undefined symbol: ap_log_error
[  error]
server has died with status 255 (t/logs/error_log wasn't created, start the 
server in the debug mode)
sh: line 1:  1523 Terminated  /usr/bin/perl5.18.1 
/pub/apps/mod_perl/t/TEST -bugreport -verbose=0
make: *** [run_tests] Error 143

Any hints?

-Andy


/usr/lib64/httpd/modules/mod_apreq2.so isn't built for httpd 2.4, which has no 
ap_log_error symbol (ap_log_error is a macro that maps to something else).

--
Born in Roswell... married an alien...
http://emptyhammock.com/



Oh.. a hold over from when I was previously playing with mod_perl.  I'll blow 
it away and try again.

Thanks

-Andy




Re: support for Apache 2.4

2014-02-20 Thread Andy Colson

On 02/20/2014 02:57 PM, Andy Colson wrote:

On 02/20/2014 02:53 PM, Jeff Trawick wrote:

On Thu, Feb 20, 2014 at 3:49 PM, Andy Colson mailto:a...@squeakycode.net>> wrote:

On 02/16/2014 09:36 AM, Steve Hay wrote:

On 16 February 2014 15:11, Dominic Hargreaves mailto:d...@earth.li>> wrote:

On Sun, Feb 16, 2014 at 11:10:20PM +1100, Carl Brewer wrote:

Having just downloaded this latest SVN repo, a grep for "2.4" 
in the
root dir shows a couple of changes, but no explicit mention of 
2.4
support.

Before I try it, does it actually support 2.4 yet?


The Debian project is shipping mod_perl with httpd24 support
based on 
http://svn.apache.org/repos/__asf/perl/modperl/branches/__httpd24/ 
<http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24/>.
This appears to be good enough for our needs, so you might like to 
give
it a try (our packages are based on a somewhat older version of that
branch, and there seem to be quite a number of changes going in, so
it's worth giving that a go. I haven't heard about any current 
plans for
merging this to trunk, though.


An update on the state of things regarding httpd-2.4 support in 
mod_perl:

We are working hard to get this done and are 99% of the way there.
Both volunteers and volunteers' time is limited, though, so progress
has been slow. A lot of work has taken place in the httpd24 branch,
and as Dominic says, some Linux distros are already shipping that.

Further improvements to mod_perl have also been made in the threading
branch, and in a bid to improve the state of httpd-2.4 support on
Windows I recently merged the two together in a new branch called
httpd24threading. This is where current development activity is taking
place, and we are now sufficiently close that I expect this to be
merged back to trunk soon.


I'm on Slackware64 14.1.
svn co 
http://svn.apache.org/repos/__asf/perl/modperl/branches/__httpd24threading/ 
<http://svn.apache.org/repos/asf/perl/modperl/branches/httpd24threading/> 
mod_perl
cd mod_perl
perl Makefile.PL
... seemed ok ...
make
... seed ok...
make test

make[1]: Leaving directory `/pub/apps/mod_perl/xs'
/usr/bin/perl5.18.1 -Iblib/arch -Iblib/lib \
t/TEST -clean
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST -clean
APACHE_TEST_GROUP= APACHE_TEST_APXS= APACHE_TEST_HTTPD= APACHE_TEST_USER= 
APACHE_TEST_PORT= \
/usr/bin/perl5.18.1 -Iblib/arch -Iblib/lib \
t/TEST -bugreport -verbose=0
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST 
-bugreport -verbose=0
/usr/sbin/httpd  -d /pub/apps/mod_perl/t -f 
/pub/apps/mod_perl/t/conf/__httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.4.6 (event MPM)

waiting 300 seconds for server to start: .httpd: Syntax error on line 97 of 
/pub/apps/mod_perl/t/conf/__httpd.conf: Cannot load 
/usr/lib64/httpd/modules/mod___apreq2.so into server: 
/usr/lib64/httpd/modules/mod___apreq2.so: undefined symbol: ap_log_error
[  error]
server has died with status 255 (t/logs/error_log wasn't created, start the 
server in the debug mode)
sh: line 1:  1523 Terminated  /usr/bin/perl5.18.1 
/pub/apps/mod_perl/t/TEST -bugreport -verbose=0
make: *** [run_tests] Error 143

Any hints?

-Andy


/usr/lib64/httpd/modules/mod_apreq2.so isn't built for httpd 2.4, which has no 
ap_log_error symbol (ap_log_error is a macro that maps to something else).

--
Born in Roswell... married an alien...
http://emptyhammock.com/



Oh.. a hold over from when I was previously playing with mod_perl.  I'll blow 
it away and try again.

Thanks

-Andy




Got another error.  Looks like an apache config problem?


ulimit -c unlimited; /usr/bin/perl5.18.1 /pub/apps/mod_perl/t/TEST -bugreport 
-verbose=0
/usr/sbin/httpd  -d /pub/apps/mod_perl/t -f 
/pub/apps/mod_perl/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS
using Apache/2.4.6 (event MPM)

waiting 300 seconds for server to start: .[Thu Feb 20 15:03:57.520565 2014] 
[env:warn] [pid 26673:tid 140126673885056] AH01506: PassEnv variable 
LD_LIBRARY_PATH was undefined
AH00526: Syntax error on line 1194 of /pub/apps/mod_perl/t/conf/httpd.conf:
Invalid command 'Order', perhaps misspelled or defined by a module not included 
in the server configuration
[  error]
server has died with status 255 (t/logs/error_log wasn't created, start the 
server in the debug mode)
sh: line 1: 26577 Terminated  /usr/bin/perl5.18.1 
/pub/apps/mod_perl/t/TEST -bugreport -verbose=0
mak