Problem running 'make test' on MacOSX

2005-03-09 Thread Ron Grunwald
Dear modperl users,
I'm attempting to build and install mod_perl 2 for Apache 2.0.53
on MacOSX 10.3 (Darwin kernel 7.7.0). The source distribution
for mod_perl (2.0.0-RC4) compiled cleanly without any problems.
However, when I attempt to run "make test", the test Apache server
fails to start and consequently aborts.
I am running "make test" under my login, and I have full write
permissions in /usr/local/src which is where mod_perl and httpd
are built. I'm just wondering if anyone else has attempted this
on a MacOSX platform and experienced similar behaviour ? Any
suggestions would be most appreciated.
Cheers, Ron.
Below is the console output generated from "make test".
sh-2.05b$ pwd
/usr/local/src/mod_perl-2.0.0-RC4
sh-2.05b$ make test
cd "src/modules/perl" && make
make[1]: Nothing to be done for `all'.
/usr/local/bin/perl -Iblib/arch -Iblib/lib \
t/TEST -clean
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/local/bin/perl  
/usr/local/src/mod_perl-2.0.0-RC4/t/TEST -clean
APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT=  
APACHE_TEST_USER= APACHE_TEST_APXS= \
/usr/local/bin/perl -Iblib/arch -Iblib/lib \
t/TEST -bugreport -verbose=0
[warning] setting ulimit to allow core files
ulimit -c unlimited; /usr/local/bin/perl  
/usr/local/src/mod_perl-2.0.0-RC4/t/TEST -bugreport -verbose=0
/usr/local/apache2/bin/httpd  -d /usr/local/src/mod_perl-2.0.0-RC4/t -f  
/usr/local/src/mod_perl-2.0.0-RC4/t/conf/httpd.conf -D APACHE2 -D  
PERL_USEITHREADS
using Apache/2.0.53 (prefork MPM)

waiting 120 seconds for server to start: ..[Tue Mar 08 11:54:25 2005]  
[info] 7 Apache:: modules loaded
[Tue Mar 08 11:54:25 2005] [info] 0 APR:: modules loaded
[Tue Mar 08 11:54:25 2005] [info] base server + 27 vhosts ready to run  
tests
.
waiting 120 seconds for server to start: ok (waited 15 secs)
server localhost:8529 started
server localhost:8530 listening (filter_out_apache)
server localhost:8531 listening (TestModperl::merge)
server localhost:8532 listening (TestModperl::perl_options)
server localhost:8533 listening (TestModperl::setupenv)
server localhost:8534 listening (TestModules::proxy)
server localhost:8535 listening (TestUser::rewrite)
server localhost:8536 listening (TestVhost::config)
server localhost:8537 listening (TestVhost::log)
server localhost:8538 listening (TestProtocol::echo_bbs)
server localhost:8539 listening (TestProtocol::echo_bbs2)
server localhost:8540 listening (TestProtocol::echo_block)
server localhost:8541 listening (TestProtocol::echo_filter)
server localhost:8542 listening (TestProtocol::echo_nonblock)
server localhost:8543 listening (TestProtocol::echo_timeout)
server localhost:8544 listening (TestProtocol::pseudo_http)
server localhost:8545 listening (TestPreConnection::note)
server localhost:8546 listening (TestHooks::hookrun)
server localhost:8547 listening (TestHooks::init)
server localhost:8548 listening (TestHooks::stacked_handlers2)
server localhost:8549 listening (TestHooks::startup)
server localhost:8550 listening (TestHooks::trans)
server localhost:8551 listening (TestFilter::both_str_con_add)
server localhost:8552 listening (TestFilter::in_bbs_inject_header)
server localhost:8553 listening (TestFilter::in_bbs_msg)
server localhost:8554 listening (TestFilter::in_str_msg)
server localhost:8555 listening (TestDirective::perlmodule)
server localhost:8556 listening (TestDirective::perlrequire)
server localhost:8557 listening (TestDirective::perlloadmodule3)
server localhost:8558 listening (TestDirective::perlloadmodule4)
server localhost:8559 listening (TestDirective::perlloadmodule5)
server localhost:8560 listening (TestDirective::perlloadmodule6)

still waiting for server to warm up:  
 
.
the server is down, giving up after 121 secs
[  error] failed to start server! (please examine t/logs/error_log)
++
| Please file a bug report: http://perl.apache.org/bugs/ |
++
make: *** [run_tests] Error 1
sh-2.05b$ cat t/logs/error_log
END in modperl_extra.pl, pid=19683
[Tue Mar 08 11:54:39 2005] [emerg] (13)Permission denied: Couldn't  
create accept lock
END in modperl_extra.pl, pid=19687
sh-2.05b$


Author  : Ron Grunwald
Position: IT Desktop Support Officer
Organisation: Edith Cowan University
Faculty : KITSC
Location: Mount Lawley, Western Australia
Email   : [EMAIL PROTECTED]
Alt. Email  : [EMAIL PROTECTED]
Telephone   : 9370 6168
Mobile Ph.  : 0419 041 786

"He who play with root will eventually kill tree !"


mod_perl/Apache troubles with cell phone

2005-03-09 Thread Rodger Castle
I've been pulling my hair out this evening trying to resolve a problem serving 
content to a cell phone.

Phone is a LG VX-4500.  I've written a simple handler as a start to just send 
"Hello" to the phone along with a Content-Length and Connection: Close header 
but the phone just times out.  With a browser, all is well.  File-based (non 
mod_perl) content gets to the phone fine, it's only the mod_perl content that 
is timing  out.  I can see the requests coming and going in the logs.  It looks 
like the data just never gets sent back to the phone.

Running:
Debian Sarge
Apache 2.0.52
mod_perl2

Any thoughts on this would be appreciated.

Rodger


How to link mod_perl with a debugging libperl?

2005-03-09 Thread Dominique Quatravaux
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello mod_perl hackers,
Contrary to what I (mis?)understood from the documentation, MP_DEBUG
does not allow one to link mod_perl against the debugging libperl.a:
~  $   debugperl Makefile.PL MP_INST_APACHE2=1 MP_APXS=/usr/bin/apxs2\
~  MP_APR_CONFIG=/usr/bin/apr-config MP_DEBUG=1
~  [...]
~  $   grep MODPERL_LDOPTS src/modules/perl/Makefile
MODPERL_LDOPTS = -rdynamic  -L/usr/local/lib
/usr/lib/perl/5.6.1/auto/DynaLoader/DynaLoader.a
- -L/usr/lib/perl/5.6.1/CORE -lperl -ldl -lm -lc -lcrypt
...No -lperld there (not that it would help my case, I need a
"-ldebugperl" for Debian's perl-debug packaging anyway). After reading
the source, I thought I found a way to trick ExtUtils::Embed into
doing what I want. I appended "-- -ldebugperl" onto the Makefile.PL
command line, but the result was thus:
MODPERL_LDOPTS =  -rdynamic  -L/usr/local/lib
- -L/usr/lib/perl/5.6.1/CORE -ldebugperl -ldebugperl
And so DynaLoader.a is gone, and of course the resulting mod_perl.so
doesn't bootstrap.
How can I link with -ldebugperl without manually fiddling with the
Makefile (which I did, and it works great)?
- --
Dominique QUATRAVAUX   Ingénieur senior
01 44 42 00 08 IDEALX
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCLtawMJAKAU3mjcsRAj/7AJwOiLkRZOc0CqJMHhgL5zZ+NX+sSgCgwGSs
F+dpw3YV+/U4x3N2P7TpG/Y=
=YW96
-END PGP SIGNATURE-



[JOB] Apache/mod_perl Programmer for Teacher's Union in New York

2005-03-09 Thread Aaron Ross
Hi,
Get involved in NY politics! A major mayoral slugfest is underway in New 
York. Commercials are airing. Newspapers are picking sides. You will 
help the Teacher's Union get their candidate and issues heard.

Our client is looking to hire someone to start and lead a team of 
Apache/mod_perl developers. They are a mid sized company and are just 
getting started online.

You would be the first Perl programmer and would be responsible for 
bringing Apache/mod_perl to people. Er, programmers. You will be 
responsible for extending the existing Krang based site, for designing 
new functionality. The features and applications you work on will be for 
both the public and the internal staff.

This job offers great salary, benefits and vacation. You will work 
incredibly totally reasonable hours, and a nice downtown New York location.

http://jobs.perl.org/job/2225
Aaron
Disclosure
--
We (Plus Three) delivered a Krang based website, an Apache/mod_perl 
platform for further development and some integration code that connects 
the website to their existing systems. We are in the middle of a four 
phase project and expect to be working with the client for at least 
another year.



Re: Problem running 'make test' on MacOSX

2005-03-09 Thread Stas Bekman
Ron Grunwald wrote:
Dear modperl users,
I'm attempting to build and install mod_perl 2 for Apache 2.0.53
on MacOSX 10.3 (Darwin kernel 7.7.0). The source distribution
for mod_perl (2.0.0-RC4) compiled cleanly without any problems.
However, when I attempt to run "make test", the test Apache server
fails to start and consequently aborts.
I am running "make test" under my login, and I have full write
permissions in /usr/local/src which is where mod_perl and httpd
are built. I'm just wondering if anyone else has attempted this
on a MacOSX platform and experienced similar behaviour ? Any
suggestions would be most appreciated.
[...]
[Tue Mar 08 11:54:39 2005] [emerg] (13)Permission denied: Couldn't  
create accept lock
Ron, please take a look at this thread:
http://www.issociate.de/board/post/132440/%5Bmp2%5D_test_server_cannot_start_as_non-root_user_with_worker_mpm.html
Cory didn't followup on his proposal.
--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: mod_perl/Apache troubles with cell phone

2005-03-09 Thread Stas Bekman
Rodger Castle wrote:
I've been pulling my hair out this evening trying to resolve a problem
serving content to a cell phone.
Phone is a LG VX-4500. I've written a simple handler as a start to just
send "Hello" to the phone along with a Content-Length and Connection:
Close header but the phone just times out. With a browser, all is well.
File-based (non mod_perl) content gets to the phone fine, it's only the
mod_perl content that is timing out. I can see the requests coming and
going in the logs. It looks like the data just never gets sent back to the
phone.

Running:
Debian Sarge
Apache 2.0.52
mod_perl2
Any thoughts on this would be appreciated.
Rodger, you will need to send me one of those toys if you want me to test 
it for you :)

Seriously, you provide too little information to work with. Does your 
modperl setup work with a normal browser? What do you see in error_log and 
access_log files on those requests? Finally saying, I run mod_perl2, is 
not a way to report a problem, please take a look at:
http://perl.apache.org/bugs/


--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: How to link mod_perl with a debugging libperl?

2005-03-09 Thread Stas Bekman
Dominique Quatravaux wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hello mod_perl hackers,
Contrary to what I (mis?)understood from the documentation, MP_DEBUG
does not allow one to link mod_perl against the debugging libperl.a:
~  $   debugperl Makefile.PL MP_INST_APACHE2=1 MP_APXS=/usr/bin/apxs2\
~  MP_APR_CONFIG=/usr/bin/apr-config MP_DEBUG=1
~  [...]
~  $   grep MODPERL_LDOPTS src/modules/perl/Makefile
MODPERL_LDOPTS = -rdynamic  -L/usr/local/lib
/usr/lib/perl/5.6.1/auto/DynaLoader/DynaLoader.a
- -L/usr/lib/perl/5.6.1/CORE -lperl -ldl -lm -lc -lcrypt
...No -lperld there (not that it would help my case, I need a
"-ldebugperl" for Debian's perl-debug packaging anyway). After reading
the source, I thought I found a way to trick ExtUtils::Embed into
doing what I want. I appended "-- -ldebugperl" onto the Makefile.PL
command line, but the result was thus:
MODPERL_LDOPTS =  -rdynamic  -L/usr/local/lib
- -L/usr/lib/perl/5.6.1/CORE -ldebugperl -ldebugperl
And so DynaLoader.a is gone, and of course the resulting mod_perl.so
doesn't bootstrap.
How can I link with -ldebugperl without manually fiddling with the
Makefile (which I did, and it works great)?
Dominique, I guess we (developers) all have perl built with debug enabled, 
so we never needed this feature. I suppose you could change the code to 
check whether libperld exists and link it instead of libperl under 
MP_DEBUG=1 (and send a patch here)? Please check how mp1 does it, if I 
remember correctly it did pick libperld under MP_DEBUG=1. If you need 
help, les us know. Thanks.

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: mod_perl/Apache troubles with cell phone

2005-03-09 Thread Jonathan Vanasco
Assuming the mod_perl works with a normal browser, I would ask this:
  a_ is the mod_perl serving the 'phone' directly, or is there an 
intermediary cache in between (ie, squid proxies to mod_perl or vanilla 
httpd, or a vanilla httpd proxies certain content to mod_perl)

if not, i suggest that you do so.
i put 'phone' in quotes, because most often its not the phone 
requesting data, but a proxy service on the telco's end

from my experience, and I would suggest you do a detailed time analysis 
of requesting content your end -- as phone requests i've seen work like 
this:

10:00:00 am - user visits url on phone
10:00:02 am - telco gets url from phone, processes it
10:00:05 am - telco gets around to requesting the url, because they 
have a backlog of requests from selling a service to 10M people that 
was designed for 1M, and the new servers haven't gotten in yet
10:00:10 am - telco gets the response from the url, because they have 
heavy traffic, and don't have the resources or desire to upgrade 
anytime soon.  content is placed in queue
10:00:20 am - telco starts sending content to the phone
10:00:30 am - phone finishes receiving 'hello, world'

I wish i were kidding.  some people in my office just got the t-mobile 
sidekick, which boasts such great internet connectivity that paris 
hilton can't live without it.
Great connectivity indeed -- it loaded the front page of the NYT in a 
very readable format -- except it took 4minutes to load!


On Mar 9, 2005, at 10:31 AM, Stas Bekman wrote:
Rodger Castle wrote:
I've been pulling my hair out this evening trying to resolve a problem
serving content to a cell phone.
Phone is a LG VX-4500. I've written a simple handler as a start to 
just
send "Hello" to the phone along with a Content-Length and Connection:
Close header but the phone just times out. With a browser, all is 
well.
File-based (non mod_perl) content gets to the phone fine, it's only 
the
mod_perl content that is timing out. I can see the requests coming and
going in the logs. It looks like the data just never gets sent back 
to the
phone.

Running:
Debian Sarge
Apache 2.0.52
mod_perl2
Any thoughts on this would be appreciated.
Rodger, you will need to send me one of those toys if you want me to 
test it for you :)

Seriously, you provide too little information to work with. Does your 
modperl setup work with a normal browser? What do you see in error_log 
and access_log files on those requests? Finally saying, I run 
mod_perl2, is not a way to report a problem, please take a look at:
http://perl.apache.org/bugs/


--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: How to link mod_perl with a debugging libperl?

2005-03-09 Thread Dominique Quatravaux
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Stas Bekman wrote:
|
| Dominique, I guess we (developers) all have perl built with debug
| enabled, so we never needed this feature. I suppose you could
| change the code to check whether libperld exists and link it
| instead of libperl under MP_DEBUG=1 (and send a patch here)?
OK I'll try. What about being able to pass linker args to MP_DEBUG
instead/in addition? (e.g. MP_DEBUG="-L/home/dom/myperl/lib
- -ldebugperl") Or through another variable, MP_LIBPERL_LDOPTS?
| Please check how mp1 does it, if I remember correctly it did pick
| libperld under MP_DEBUG=1.
Check.
- --
Dominique QUATRAVAUX   Ingénieur senior
01 44 42 00 08 IDEALX
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCLyn2MJAKAU3mjcsRAomhAKCqDm+2KWbqREZpCDmDQIPIYIN+KwCgmW+t
gEwJfm6bIGTDY2+091ZBNsg=
=sdF8
-END PGP SIGNATURE-



Re: mod_perl/Apache troubles with cell phone

2005-03-09 Thread Ofer Nave
Rodger Castle wrote:
I've been pulling my hair out this evening trying to resolve a problem serving 
content to a cell phone.
Phone is a LG VX-4500.  I've written a simple handler as a start to just send 
"Hello" to the phone along with a Content-Length and Connection: Close header 
but the phone just times out.  With a browser, all is well.  File-based (non mod_perl) 
content gets to the phone fine, it's only the mod_perl content that is timing  out.  I 
can see the requests coming and going in the logs.  It looks like the data just never 
gets sent back to the phone.
Running:
Debian Sarge
Apache 2.0.52
mod_perl2
Any thoughts on this would be appreciated.
Rodger
 

The first step is setting up a static wml file - a tiny hello world file 
named index.wml (make sure it has a .wml extension).  Now try to view 
that.  If that doesn't work, you're problem has nothing to do with 
mod_perl.  If it does, then you've got more work to do.  And if you've 
done this already... sorry to waste your time.  :)  And if your phone 
has a normal web browser instead of a WAP browser, ignore this 
entirely... but I'm assuming you're using a WAP browser.

I'm far from an expert, as I just started playing with WAP and WML a few 
weeks ago, but unless content-type isn't coming out correctly, your 
issue isn't mod_perl related.  You're best bet is to hit a 
WAP/WML-specific forum or mailing list for help.

Ultimately, when in doubt, try things in static pages first, and when 
you get that working, try the same thing under mod_perl.  If that 
doesn't work, use telnet to connect to your web server and request the 
document to see what exactly it's doing.  After that, it's likely to be 
obvious.

-ofer



Re: mod_perl/Apache troubles with cell phone

2005-03-09 Thread Tom Schindl
Is the content-type set appropiately? I don't know what its supposed to 
be on for a cell-phone. Any could to help you would be appreciated.

Tom
Rodger Castle wrote:
I've been pulling my hair out this evening trying to resolve a problem serving 
content to a cell phone.
Phone is a LG VX-4500.  I've written a simple handler as a start to just send 
"Hello" to the phone along with a Content-Length and Connection: Close header 
but the phone just times out.  With a browser, all is well.  File-based (non mod_perl) 
content gets to the phone fine, it's only the mod_perl content that is timing  out.  I 
can see the requests coming and going in the logs.  It looks like the data just never 
gets sent back to the phone.
Running:
Debian Sarge
Apache 2.0.52
mod_perl2
Any thoughts on this would be appreciated.
Rodger




Re: mod_perl/Apache troubles with cell phone

2005-03-09 Thread Scott Gifford
Tom Schindl <[EMAIL PROTECTED]> writes:

> Is the content-type set appropiately? I don't know what its supposed
> to be on for a cell-phone. Any could to help you would be appreciated.

It should be text/vnd.wap.wml

ScottG.


[newbie] [mp2] when are inline/anonymous subs compiled?

2005-03-09 Thread John ORourke
Hi folks, apologies if this is well known information, I did search!

My response method-handler reads a template and I want to call a different
sub for each type of 'field' I find.  I also want other packages to be able
to 'register' new subs for new 'field' types.  I'm not sure wether to use a
hash of anonymous subs or regular subs.

Question is, do anonymous subs assigned to hash values and placed in the
'new' method get compiled every time a new object is created or just when
the module file is initially loaded?

cheers
John
--

- (more detailed info follows)

I have a templating system using a method handler for the Response phase
with non-persistent objects:

sub r ($$) {
 ...read template etc...
 while( template matches /(field-type)/ ){
  defined(&{$1}) and print &{ $1 };    using non-anonymous subs
  ## OR ##   defined(&{$code{$1}}) and print &{$code{$1}};   using anon
subs
 }
}

sub new { my $self=shift; my $code={};

  if using anon subs, define them here:
 $$code{type1} = sub { do something cool; }
 $$code{type2} = sub { do something cooler; }
 $$code{type3} = sub { do something even cooler; }

 bless $self=>$code;
}


# if using non-anon subs, define them here:

sub type1 { do something cool; }
sub type2 { do something cooler; }
sub type3 { do something even cooler; }




Re: How to link mod_perl with a debugging libperl?

2005-03-09 Thread Stas Bekman
Dominique Quatravaux wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Stas Bekman wrote:
|
| Dominique, I guess we (developers) all have perl built with debug
| enabled, so we never needed this feature. I suppose you could
| change the code to check whether libperld exists and link it
| instead of libperl under MP_DEBUG=1 (and send a patch here)?
OK I'll try. What about being able to pass linker args to MP_DEBUG
instead/in addition? (e.g. MP_DEBUG="-L/home/dom/myperl/lib
- -ldebugperl") Or through another variable, MP_LIBPERL_LDOPTS?
That's not good because it'll still add -lperl, whereas MP_DEBUG could be 
made smarter to use the right lib (notice that it doesn't have to be 
libperld, it should link against it only if it finds one).

Regardless, you can always pass extra arguments throught the standard 
MakeMaker arguments. e.g. for CC

  CCFLAGS="-g" perl Makefile.PL ...
(LDDLFLAGS, etc. see the ExtUtils::MakeMaker manpage)
--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [BUG MP1/MP2] Apache should bail out in case of syntax errors in section

2005-03-09 Thread Philippe M. Chiasson
I've identified the source of the problem I believe, so can you try this patch
and let me know if it works for you? If so, I'll be working it up a bit more and
get it in.
Index: src/modules/perl/modperl_cmd.c
===
--- src/modules/perl/modperl_cmd.c  (revision 156679)
+++ src/modules/perl/modperl_cmd.c  (working copy)
@@ -554,14 +554,17 @@
 ENTER;SAVETMPS;
 save_scalar(gv); /* local $0 */
 sv_setpv_mg(GvSV(gv), directive->filename);
-eval_pv(arg, FALSE);
+eval_sv(newSVpv(arg, 0), G_KEEPERR);
 modperl_env_sync_srv_env_hash2table(aTHX_ p, scfg);
 modperl_env_sync_dir_env_hash2table(aTHX_ p, dcfg);
 FREETMPS;LEAVE;
 }

Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5


signature.asc
Description: OpenPGP digital signature


Re: [newbie] [mp2] when are inline/anonymous subs compiled?

2005-03-09 Thread Stas Bekman
John ORourke wrote:
Question is, do anonymous subs assigned to hash values and placed in the
'new' method get compiled every time a new object is created or just when
the module file is initially loaded?

  if using anon subs, define them here:
 $$code{type1} = sub { do something cool; }
 $$code{type2} = sub { do something cooler; }
 $$code{type3} = sub { do something even cooler; }
The answer: it depends on whether you create a closure or not. In the case 
of anon-sub which acts as a closure it'll recompile each time it's 
encountered. Otherwise it'll be compiled once during the module loading. 
It's explained here:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#Understanding_Closuresthe_Easy_Way

You absolutely must not create closures when running mod_perl.:
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my___Scoped_Variable_in_Nested_Subroutines
--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Problem with apache and mysql

2005-03-09 Thread Alejandro Galue
 

Hello All,

I'm using Fedora Core 3 with this packages version (RPM):

httpd-2.0.52-3.1
mod_perl-1.99_16-3
perl-DBI-1.40'5
perl-DBD-MySQL-2.9004-4
libdbi-0.6.5-10
libdbi-dbd-mysql-0.6.5-10
mysql-4.1.9-1
mysql-server-4.1.9-1
mysqlclient10-3.23.58-4

I downloaded source rpm for Mysql from fedora-development and rebuild on a
updated fedora core 3.

I have an application that run a script to read and modify mysql (this part
works great), and the web interface for this application. This web interface

was created totally with mod_perl.

After a certain amount of time, it cannot be possible to use the database
frontend via web becase it cannot connect to database. This problem appears
when we run the application in a limited RAM machine - 128 - 256MB; before
that we have never experience the problem. It has been working ok in HW with
RAM between 386MB and 512MB RAM.

I can enter to database manually and check status and mysql is up; but I
need to restart apache to have the Web front-end working properly again.

After some hours the failure shows up again.

Anyone have any idea of what is happening here ?

My guest is : the problem should be related to perl-DBI or mod_perl or maybe
the configuracion of modperl or mysql. My questions in this case:

- Does it sound like the place to look for the problem ?
- Any tips on how to turn on the debugging on this components ? How to 
figure out which one is responsible for the failure and why  ?

Thanks in advance,
Alejandro Galue.





Re: PerlTransHandler question

2005-03-09 Thread Tony Clayton
Quoting shawn <[EMAIL PROTECTED]>:

So far this working on my development environment, but what I am really
wondering about is if this will actually take the load off mod_perl?
(it's a little hard for me to tell without significant traffic) Will the
mod_perl server execute the page and release the connection and not care
how long the images server is taking? If anyone has a better solution or
an idea I would love to hear it.
OK, this is a little confusing... it's hard to tell what you are doing here.
First, I'm not sure I'd assume that a CPU usage spike can be blamed on apache
serving up images.  That should be mostly disk reads and I wouldn't expect it
to effect CPU much.  Good monitoring, logging, and load-testing might be in
order.
Second, I'm going to assert a few assumptions on what you are doing:
1) you are running (at least) two apache/mod_perl webservers... one for 
serving
static content and one for serving mod_perl requests
2) You have installed this TransHandler on both web servers, for whatever
reason, which is why you have the if statement
3) You are therefore NOT running images.webserver.com and webserver.com 
from the
same apache server instance, as you realize that this doesn't solve 
your problem
4) You also realize that the TransHandler doesn't make much sense (AFAICT) if
assertion #2 is not true.

If any of these assertions are false, we may need to back up a bit.
If these assertions are all true, then I see what you are trying to do (and in
theory it could work), but it's worth mentioning the following:
- you could send images.webserver.com in the original content, thus 
avoiding the
browser redirect and eliminating the need for the TransHandler
- I'm not sure why you would need/want mod_perl on the static content server
- you could alternatively use mod_rewrite

Note also that if you are on an OS with copy-on-write memory pages (ie: linux)
then you can keep the apache children thin and light by preloading your
mod_perl modules in the parent.  If children are thin and light, you can run
more of them for the same bang/buck.  If you are really diligent at preloading
things, then you may find that the original apache/mod_perl is light enough.
You might want to consider running two apaches together:
1) apache/mod_ssl/mod_proxy/mod_gzip/mod_mmap_static server as a front-end
2) proxying to the apache/mod_perl backend
See also:
  http://perl.apache.org/docs/1.0/guide/performance.html
If your primary concern is slow clients, then you might consider mod_gzip.
And the obvious of course... keep your images as small as possible, or provide
smaller, clickable thumbnails.


[BUG] Bad refcounting in Apache->push_handlers()

2005-03-09 Thread Dominique Quatravaux
-8<-- Start Bug Report 8<--
1. Problem Description:
I'm trying to make a PerlFixupHandler that reads:
sub ssl_is_mandatory {
 my $r = shift;
 require Apache::RequestRec;
 return 403 unless defined($r->subprocess_env("SSL_SERVER_S_DN"));
 return 0
}
Apache->push_handlers("PerlFixupHandler", \&ssl_is_mandatory);
So far so good, but when I try to do this instead:
Apache->push_handlers("PerlFixupHandler", sub { ... });
with the exact same Perl code inside the sub as above, I get extremely 
weird error messages, namely a warning ("Use of uninitialized value in 
null operation") and an error ("Undefined subroutine &main:: called"), 
neither of which having any useful backtrace information according to 
Apache::DB and some crocky breakpoints in $SIG{__WARN__} and 
$SIG{__DIE__} that I put together: for example,

 DB<1> T
$ = IDX::Debug::_die_with_stack_trace('Undefined subroutine &main:: 
called.^J') called from -e line 0
$ = eval {...} called from -e line 0

Attaching gdb on a mod_perl recompiled with -ldebugperl (*not* the 
configuration described in the report below, but close), I get this, 
just before the "Undefined subroutine &main:: called" is thrown:

#0  0x4040538e in read () from /lib/tls/libc.so.6
#1  0x4046bc60 in sys_sigabbrev () from /lib/tls/libc.so.6
#2  0x403a6ece in _IO_file_underflow () from /lib/tls/libc.so.6
#3  0x403a91dd in _IO_default_uflow () from /lib/tls/libc.so.6
#4  0x403a8ffe in __uflow () from /lib/tls/libc.so.6
#5  0x403a32e8 in getc () from /lib/tls/libc.so.6
#6  0x406133b1 in Perl_sv_gets (sv=0x88a5910, fp=0x86d8480, append=0)
   at sv.c:4481
#7  0x40603e1b in Perl_do_readline () at pp_hot.c:1453
#8  0x405fff60 in Perl_pp_readline () at pp_hot.c:227
#9  0x405fef2d in Perl_runops_debug () at run.c:53
#10 0x40639833 in S_docatch_body () at pp_ctl.c:2598
#11 0x40639919 in S_docatch (o=0x88d47d0) at pp_ctl.c:2624
#12 0x4063c486 in Perl_pp_entereval () at pp_ctl.c:3367
#13 0x405fef2d in Perl_runops_debug () at run.c:53
#14 0x405a52ed in S_call_body (myop=0xb7e4, is_eval=0) at perl.c:1892
#15 0x405a4be6 in perl_call_sv (sv=0x861b0ec, flags=2) at perl.c:1771
#16 0x405ef2fb in Perl_vdie (pat=0x4067c480 "Undefined subroutine &%s 
called",
   args=0xb890) at util.c:1606
#17 0x405ef504 in Perl_die (pat=0x4067c480 "Undefined subroutine &%s 
called")
   at util.c:1641
#18 0x40607d37 in Perl_pp_entersub () at pp_hot.c:2416
#19 0x405a52d5 in S_call_body (myop=0xba54, is_eval=0) at perl.c:1889
#20 0x405a4f54 in perl_call_sv (sv=0x8753310, flags=4) at perl.c:1810
#21 0x40588a47 in modperl_callback (handler=0x8813aa0, p=0x888a998, r=0x0,
   s=0x80bab50, args=0x87348c0) at modperl_callback.c:100
#22 0x4058919f in modperl_callback_run_handlers (idx=0, type=1, r=0x0, 
c=0x0,
   s=0x80bab50, pconf=0x888a998, plog=0x0, ptemp=0x0, 
run_mode=MP_HOOK_VOID)
   at modperl_callback.c:261
#23 0x40589798 in modperl_callback_process (idx=0, p=0x888a998, 
s=0x80bab50,
   run_mode=MP_HOOK_VOID) at modperl_callback.c:403
#24 0x4059edf0 in modperl_child_init_handler (p=0x888a998, s=0x80bab50)
   at modperl_hooks.c:17
#25 0x0807817d in ap_run_child_init ()
#26 0x080765d1 in ap_graceful_stop_signalled ()
#27 0x08076a07 in ap_graceful_stop_signalled ()
#28 0x08076b28 in ap_graceful_stop_signalled ()
#29 0x0807739a in ap_mpm_run ()
#30 0x0807d96d in main ()
#31 0x40350904 in __libc_start_main () from /lib/tls/libc.so.6

So this looks a lot like modperl_callback is calling a CV that has been 
free()d before at modperl_callback line 100. Being a nearly complete 
ignorant in XS, I cannot investigate much further on my own, but I can 
certainly run experiments on your behalf, apply patches, etc.

This problem isn't blocking me anymore as I found an adequate 
workaround, namely to not use an anonymous sub (albeit after 2 days of 
debugging). So please, Stas and all, don't rush to rescue me, it's very 
nice of you but a bit embarassing at times :-)

2. Used Components and their Configuration:
Well after my third report I guess you know the drill, but here it goes:
*** mod_perl version 1.999021
*** using /home/dom/ftp/mod_perl-2.0.0-RC4/lib/Apache/BuildConfig.pm
*** Makefile.PL options:
 MP_APR_CONFIG   => /usr/bin/apr-config
 MP_APR_LIB  => aprext
 MP_APXS => /usr/bin/apxs2
 MP_COMPAT_1X=> 1
 MP_GENERATE_XS  => 1
 MP_INST_APACHE2 => 1
 MP_LIBNAME  => mod_perl
 MP_USE_DSO  => 1
*** /usr/sbin/apache2 -V
Server version: Apache/2.0.52
Server built:   Nov 10 2004 11:57:35
Server's Module Magic Number: 20020903:9
Architecture:   32-bit
Server compiled with
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_SYSVSEM_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT=""
-D SUEXEC_BIN="/usr/lib/apache2/suexec2"
-D DEFAULT_PIDLOG="/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apach

Re: Problem with apache and mysql

2005-03-09 Thread Tom Schindl
Are there any messages in the Apache-Errorlog or in the one of MySQL. 
Maybe you are opening connections and don't close them, ... . You could 
also run the DBI in Debugging mode. Do you use Apache::DBI?

Tom
Alejandro Galue wrote:

Hello All,
I'm using Fedora Core 3 with this packages version (RPM):
httpd-2.0.52-3.1
mod_perl-1.99_16-3
perl-DBI-1.40'5
perl-DBD-MySQL-2.9004-4
libdbi-0.6.5-10
libdbi-dbd-mysql-0.6.5-10
mysql-4.1.9-1
mysql-server-4.1.9-1
mysqlclient10-3.23.58-4
I downloaded source rpm for Mysql from fedora-development and rebuild on a
updated fedora core 3.
I have an application that run a script to read and modify mysql (this part
works great), and the web interface for this application. This web interface
was created totally with mod_perl.
After a certain amount of time, it cannot be possible to use the database
frontend via web becase it cannot connect to database. This problem appears
when we run the application in a limited RAM machine - 128 - 256MB; before
that we have never experience the problem. It has been working ok in HW with
RAM between 386MB and 512MB RAM.
I can enter to database manually and check status and mysql is up; but I
need to restart apache to have the Web front-end working properly again.
After some hours the failure shows up again.
Anyone have any idea of what is happening here ?
My guest is : the problem should be related to perl-DBI or mod_perl or maybe
the configuracion of modperl or mysql. My questions in this case:
- Does it sound like the place to look for the problem ?
- Any tips on how to turn on the debugging on this components ? How to 
figure out which one is responsible for the failure and why  ?

Thanks in advance,
Alejandro Galue.

 




Re: Problem with apache and mysql

2005-03-09 Thread Gokul P. Nair
My suggestion would be to use Apache::DBI too if ur
not already doing so. my guess is that the database
handles open by DBI (not to be mistaken for
Apache::DBI) might remain open eventually leading to
inability to access mysql anymore.

hope that helps.

Gokul

--- Alejandro Galue <[EMAIL PROTECTED]> wrote:
>  
> 
> Hello All,
> 
> I'm using Fedora Core 3 with this packages version
> (RPM):
> 
> httpd-2.0.52-3.1
> mod_perl-1.99_16-3
> perl-DBI-1.40'5
> perl-DBD-MySQL-2.9004-4
> libdbi-0.6.5-10
> libdbi-dbd-mysql-0.6.5-10
> mysql-4.1.9-1
> mysql-server-4.1.9-1
> mysqlclient10-3.23.58-4
> 
> I downloaded source rpm for Mysql from
> fedora-development and rebuild on a
> updated fedora core 3.
> 
> I have an application that run a script to read and
> modify mysql (this part
> works great), and the web interface for this
> application. This web interface
> 
> was created totally with mod_perl.
> 
> After a certain amount of time, it cannot be
> possible to use the database
> frontend via web becase it cannot connect to
> database. This problem appears
> when we run the application in a limited RAM machine
> - 128 - 256MB; before
> that we have never experience the problem. It has
> been working ok in HW with
> RAM between 386MB and 512MB RAM.
> 
> I can enter to database manually and check status
> and mysql is up; but I
> need to restart apache to have the Web front-end
> working properly again.
> 
> After some hours the failure shows up again.
> 
> Anyone have any idea of what is happening here ?
> 
> My guest is : the problem should be related to
> perl-DBI or mod_perl or maybe
> the configuracion of modperl or mysql. My questions
> in this case:
> 
> - Does it sound like the place to look for the
> problem ?
> - Any tips on how to turn on the debugging on this
> components ? How to 
> figure out which one is responsible for the failure
> and why  ?
> 
> Thanks in advance,
> Alejandro Galue.
> 
> 
> 
> 




__ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/


Foolish Q - 2.0_RC4?

2005-03-09 Thread William A. Rowe, Jr.
I can't seem to locate the source repository point for _RC4...

Looked in;

http://svn.apache.org/repos/asf/perl/modperl/tags/

as well as

http://cvs.apache.org/viewcvs.cgi/
(which I see modperl2 is now gone.)

Any pointers?  Would like to give this a thorough drubbing
so I can toss my ++ into the ring for release :)

Bill



RE: PerlTransHandler question

2005-03-09 Thread shawn

Thanks for the detailed response; all your assumptions are correct
almost... Maybe if I give a bit more detail on the structure someone
could suggest a better strategy.

I have one apache server with mod_perl enabled. I have done a fair bit
of tuning and preloading so it runs quite well, one of its main
functions is to allow users to upload images, it then cuts the images up
into different sizes and places them in different directories. Although
recently users have been uploading large pdf catalogs which they claim
are very important. Currently this server is the only server running
and serves up every page


SetHandler perl-script
PerlModule Apache::ASP
PerlHeaderparserHandler Apache::SearchBot
ExpiresActive On
PerlHandler Apache::ASP
PerlSetVar UseStrict 1
PerlSetVar Debug 2
PerlSetVar Global /tmp  


My main problem is then when general browsers start to download these
pdfs they hold a mod_perl connection open for way to long. There for I
have set up images.webserver.com which is just a small apache server
that is not using mod_perl and that is what is listed in my previous
message.


I am aware that I could just change the links to the pdfs but that is
allot of code changes and may cause problems with the image upload code
etc. My desired solution is to keep the mod_perl as the front end and
have something else serve up the images, I have been fooling around with
mod_rewrite but havent been able achive the desired effect. I have tried
variations of the following.


RewriteEngine On
RewriteRule \.(htm|html|cgi|images)$ - [last]
Options FollowSymLinks
RewriteRule ^/(.*)$ http://images.webserver.com:80/$1 [r]

SetHandler perl-script
PerlModule Apache::ASP
PerlHeaderparserHandler Apache::SearchBot
ExpiresActive On
PerlHandler Apache::ASP
PerlSetVar UseStrict 1
PerlSetVar Debug 2
PerlSetVar Global /tmp  



Another reason why I would like the mod_perl server to be the front end
is because it has ssl enabled and there will be problems with the cert
across different server.


Any thoughts?


Shawn



-Original Message-
From: Tony Clayton [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 08, 2005 8:15 PM
To: modperl@perl.apache.org
Subject: Re: PerlTransHandler question

Quoting shawn <[EMAIL PROTECTED]>:


> So far this working on my development environment, but what I am
really
> wondering about is if this will actually take the load off mod_perl?
> (it's a little hard for me to tell without significant traffic) Will
the
> mod_perl server execute the page and release the connection and not
care
> how long the images server is taking? If anyone has a better solution
or
> an idea I would love to hear it.

OK, this is a little confusing... it's hard to tell what you are doing
here.
First, I'm not sure I'd assume that a CPU usage spike can be blamed on
apache
serving up images.  That should be mostly disk reads and I wouldn't
expect it
to effect CPU much.  Good monitoring, logging, and load-testing might be
in
order.

Second, I'm going to assert a few assumptions on what you are doing:
1) you are running (at least) two apache/mod_perl webservers... one for 
serving
static content and one for serving mod_perl requests
2) You have installed this TransHandler on both web servers, for
whatever
reason, which is why you have the if statement
3) You are therefore NOT running images.webserver.com and webserver.com 
from the
same apache server instance, as you realize that this doesn't solve 
your problem
4) You also realize that the TransHandler doesn't make much sense
(AFAICT) if
assertion #2 is not true.

If any of these assertions are false, we may need to back up a bit.

If these assertions are all true, then I see what you are trying to do
(and in
theory it could work), but it's worth mentioning the following:
- you could send images.webserver.com in the original content, thus 
avoiding the
browser redirect and eliminating the need for the TransHandler
- I'm not sure why you would need/want mod_perl on the static content
server
- you could alternatively use mod_rewrite

Note also that if you are on an OS with copy-on-write memory pages (ie:
linux)
then you can keep the apache children thin and light by preloading your
mod_perl modules in the parent.  If children are thin and light, you can
run
more of them for the same bang/buck.  If you are really diligent at
preloading
things, then you may find that the original apache/mod_perl is light
enough.

You might want to consider running two apaches together:
1) apache/mod_ssl/mod_proxy/mod_gzip/mod_mmap_static server as a
front-end
2) proxying to the apache/mod_perl backend

See also:
   http://perl.apache.org/docs/1.0/guide/performance.html

If your primary concern is slow clients, then you might consider
mod_gzip.

And the obvious of course... keep your images as small as possible, or
provide
smaller

Re: Foolish Q - 2.0_RC4?

2005-03-09 Thread Geoffrey Young


William A. Rowe, Jr. wrote:
> I can't seem to locate the source repository point for _RC4...
> 
> Looked in;
> 
> http://svn.apache.org/repos/asf/perl/modperl/tags/

from the Changes file I think it's this

http://svn.apache.org/repos/asf/perl/modperl/tags/1_999_21/

> 
> as well as
> 
> http://cvs.apache.org/viewcvs.cgi/
> (which I see modperl2 is now gone.)

http://svn.apache.org/viewcvs.cgi/perl/modperl/

?

> 
> Any pointers?  Would like to give this a thorough drubbing
> so I can toss my ++ into the ring for release :)

official releases are also always on

  http://svn.apache.org/viewcvs.cgi/perl/modperl/

and

  http://search.cpan.org/dist/mod_perl/

HTH

--Geoff


Re: Foolish Q - 2.0_RC4?

2005-03-09 Thread Geoffrey Young

> official releases are also always on
> 
>   http://svn.apache.org/viewcvs.cgi/perl/modperl/

blarg, cut and paste error.  I meant

  http://perl.apache.org/dist/

--Geoff


Re: Foolish Q - 2.0_RC4?

2005-03-09 Thread William A. Rowe, Jr.
At 07:05 PM 3/9/2005, Geoffrey Young wrote:

>> official releases are also always on
>> 
>>   http://svn.apache.org/viewcvs.cgi/perl/modperl/
>
>blarg, cut and paste error.  I meant
>
>  http://perl.apache.org/dist/

I hope you ment http://www.apache.org/dist/perl/ since that's
what our mirrors capture.

That said, I always work from the repositories, so thanks for
the pointer :)






RE: PerlTransHandler question

2005-03-09 Thread David J Radunz
On Wed, 2005-03-09 at 17:53 -0700, shawn wrote:
> Thanks for the detailed response; all your assumptions are correct
> almost... Maybe if I give a bit more detail on the structure someone
> could suggest a better strategy.
> 
> I have one apache server with mod_perl enabled. I have done a fair bit
> of tuning and preloading so it runs quite well, one of its main
> functions is to allow users to upload images, it then cuts the images up
> into different sizes and places them in different directories. Although
> recently users have been uploading large pdf catalogs which they claim
> are very important. Currently this server is the only server running
> and serves up every page
> 
> 
>   SetHandler perl-script
>   PerlModule Apache::ASP
>   PerlHeaderparserHandler Apache::SearchBot
>   ExpiresActive On
>   PerlHandler Apache::ASP
>   PerlSetVar UseStrict 1
>   PerlSetVar Debug 2
>   PerlSetVar Global /tmp  
> 
> 
> My main problem is then when general browsers start to download these
> pdfs they hold a mod_perl connection open for way to long. There for I
> have set up images.webserver.com which is just a small apache server
> that is not using mod_perl and that is what is listed in my previous
> message.
> 
> 
> I am aware that I could just change the links to the pdfs but that is
> allot of code changes and may cause problems with the image upload code
> etc. My desired solution is to keep the mod_perl as the front end and
> have something else serve up the images, I have been fooling around with
> mod_rewrite but havent been able achive the desired effect. I have tried
> variations of the following.
> 
> 
>   RewriteEngine On
>   RewriteRule \.(htm|html|cgi|images)$ - [last]
>   Options FollowSymLinks
>   RewriteRule ^/(.*)$ http://images.webserver.com:80/$1 [r]
> 
>   SetHandler perl-script
>   PerlModule Apache::ASP
>   PerlHeaderparserHandler Apache::SearchBot
>   ExpiresActive On
>   PerlHandler Apache::ASP
>   PerlSetVar UseStrict 1
>   PerlSetVar Debug 2
>   PerlSetVar Global /tmp  
> 
> 
> 

Why is your rewrite rule inside the FilesMatch? Surely it should be
outside if you want it to match images (or anything other than just .htm
files :)

> Another reason why I would like the mod_perl server to be the front end
> is because it has ssl enabled and there will be problems with the cert
> across different server.
> 
> 
> Any thoughts?
> 
> 
> Shawn
> 
> 
> 
> -Original Message-
> From: Tony Clayton [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, March 08, 2005 8:15 PM
> To: modperl@perl.apache.org
> Subject: Re: PerlTransHandler question
> 
> Quoting shawn <[EMAIL PROTECTED]>:
> 
> 
> > So far this working on my development environment, but what I am
> really
> > wondering about is if this will actually take the load off mod_perl?
> > (it's a little hard for me to tell without significant traffic) Will
> the
> > mod_perl server execute the page and release the connection and not
> care
> > how long the images server is taking? If anyone has a better solution
> or
> > an idea I would love to hear it.
> 
> OK, this is a little confusing... it's hard to tell what you are doing
> here.
> First, I'm not sure I'd assume that a CPU usage spike can be blamed on
> apache
> serving up images.  That should be mostly disk reads and I wouldn't
> expect it
> to effect CPU much.  Good monitoring, logging, and load-testing might be
> in
> order.
> 
> Second, I'm going to assert a few assumptions on what you are doing:
> 1) you are running (at least) two apache/mod_perl webservers... one for 
> serving
> static content and one for serving mod_perl requests
> 2) You have installed this TransHandler on both web servers, for
> whatever
> reason, which is why you have the if statement
> 3) You are therefore NOT running images.webserver.com and webserver.com 
> from the
> same apache server instance, as you realize that this doesn't solve 
> your problem
> 4) You also realize that the TransHandler doesn't make much sense
> (AFAICT) if
> assertion #2 is not true.
> 
> If any of these assertions are false, we may need to back up a bit.
> 
> If these assertions are all true, then I see what you are trying to do
> (and in
> theory it could work), but it's worth mentioning the following:
> - you could send images.webserver.com in the original content, thus 
> avoiding the
> browser redirect and eliminating the need for the TransHandler
> - I'm not sure why you would need/want mod_perl on the static content
> server
> - you could alternatively use mod_rewrite
> 
> Note also that if you are on an OS with copy-on-write memory pages (ie:
> linux)
> then you can keep the apache children thin and light by preloading your
> mod_perl modules in the parent.  If children are thin and light, you can
> run
> more of them for the same bang/buck.  If you are really diligent at
> preloading
> things, then you may find that the original apache/mod_perl is l

Re: PerlTransHandler question

2005-03-09 Thread Perrin Harkins
shawn wrote:
I am aware that I could just change the links to the pdfs but that is
allot of code changes and may cause problems with the image upload code
etc.
Or you could use a proxy server.
Another reason why I would like the mod_perl server to be the front end
is because it has ssl enabled and there will be problems with the cert
across different server.
That would not be a problem for a proxy server.
- Perrin


Re: [BUG] Bad refcounting in Apache->push_handlers()

2005-03-09 Thread Stas Bekman
Dominique Quatravaux wrote:
-8<-- Start Bug Report 8<--
1. Problem Description:
I'm trying to make a PerlFixupHandler that reads:
sub ssl_is_mandatory {
 my $r = shift;
 require Apache::RequestRec;
 return 403 unless defined($r->subprocess_env("SSL_SERVER_S_DN"));
 return 0
}
Apache->push_handlers("PerlFixupHandler", \&ssl_is_mandatory);
So far so good, but when I try to do this instead:
Apache->push_handlers("PerlFixupHandler", sub { ... });
where do you call the above, Dominique? At the server startup?
with the exact same Perl code inside the sub as above, I get extremely 
weird error messages, namely a warning ("Use of uninitialized value in 
null operation") and an error ("Undefined subroutine &main:: called"), 
neither of which having any useful backtrace information according to 
Apache::DB and some crocky breakpoints in $SIG{__WARN__} and 
$SIG{__DIE__} that I put together: for example,

 DB<1> T
$ = IDX::Debug::_die_with_stack_trace('Undefined subroutine &main:: 
called.^J') called from -e line 0
$ = eval {...} called from -e line 0
[...]
So this looks a lot like modperl_callback is calling a CV that has been 
free()d before at modperl_callback line 100. Being a nearly complete 
ignorant in XS, I cannot investigate much further on my own, but I can 
certainly run experiments on your behalf, apply patches, etc.

This problem isn't blocking me anymore as I found an adequate 
workaround, namely to not use an anonymous sub (albeit after 2 days of 
debugging). So please, Stas and all, don't rush to rescue me, it's very 
nice of you but a bit embarassing at times :-)
Here is some explanation of what's happening inside:
/* How anon-subs are handled:
 * We have two ways anon-subs can be registered
 * A) at startup from httpd.conf:
 *PerlTransHandler 'sub { ... }'
 * B) run-time perl code
 *$r->push_handlers(PerlTransHandler => sub {  });
 *
 * In the case of non-threaded perl, we just compile A or grab B and
 * store it in the mod_perl struct and call it when it's used. No
 * problems here
 *
 * In the case of threads, things get more complicated. we no longer
 * can store the CV value of the compiled anon-sub, since when
 * perl_clone is called each interpreter will have a different CV
 * value. since we need to be able to have 1 entry for each anon-sub
 * across all interpreters a different solution is needed. to remind
 * in the case of named subs, we just store the name of the sub and
 * look its corresponding CV when we need it.
 *
 * The used solution: each process has a global counter, which always
 * grows. Every time a new anon-sub is encountered, a new ID is
 * allocated from that process-global counter and that ID is stored in
 * the mod_perl struct. The compiled CV is stored as
 * $PL_modglobal{ANONSUB}{$id} = CV;
 * when perl_clone is called, each clone will clone that CV value, but
 * we will still be able to find it, since we stored it in the
 * hash. so we retrieve the CV value, whatever it is and we run it.
 *
 * that explanation can be written and run in perl:
 *
 * use threads;
 * our %h;
 * $h{x} = eval 'sub { print qq[this is sub @_\n] }';
 * $h{x}->("main");
 * threads->new(sub { $h{x}->(threads->self->tid)});
 *
 * XXX: more nuances will follow
 */
but I'm confused as you are using 5.6.1 w/o threads. it should have worked 
there just fine.

Any chance you could add a test to the modperl2 test suite that I can 
reproduce the problem with? If you don't manage to I'll try to write one. 
You can take a look at one of:

t/hooks/TestHooks/inlined_handlers.pm
t/hooks/TestHooks/push_handlers_same_phase.pm
t/hooks/TestHooks/stacked_handlers2.pm
t/hooks/TestHooks/stacked_handlers.pm
t/hooks/TestHooks/push_handlers_blessed.pm
t/hooks/TestHooks/set_handlers.pm
t/hooks/TestHooks/push_handlers.pm
Thanks.
--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Solved: Problem running 'make test' on MacOSX

2005-03-09 Thread Ron Grunwald
Hello Stas,
Thank you for your suggestion. I read through the thread as you  
suggested,
and the underlying fault seems to be permissions related. I built  
mod_perl
under my own login, which is an ADS network account, and noticed that  
the
UID is a very large integer. I somehow thought that this could be  
contributing
to the problem and so decided to create a local user account on my  
MacOSX system.
This account lists much lower integers for UID and GID in the shell.

I rebuilt mod_perl under this new, local account and then ran 'make  
test'.
It all ran sensationally well this time and all the tests passed.
Thank you for the pointer that planted the seed.

Best Regards,
Ron.
On 09/03/2005, at 11:28 PM, Stas Bekman wrote:
Ron Grunwald wrote:
Dear modperl users,
I'm attempting to build and install mod_perl 2 for Apache 2.0.53
on MacOSX 10.3 (Darwin kernel 7.7.0). The source distribution
for mod_perl (2.0.0-RC4) compiled cleanly without any problems.
However, when I attempt to run "make test", the test Apache server
fails to start and consequently aborts.
I am running "make test" under my login, and I have full write
permissions in /usr/local/src which is where mod_perl and httpd
are built. I'm just wondering if anyone else has attempted this
on a MacOSX platform and experienced similar behaviour ? Any
suggestions would be most appreciated.
[...]
[Tue Mar 08 11:54:39 2005] [emerg] (13)Permission denied: Couldn't   
create accept lock
Ron, please take a look at this thread:
http://www.issociate.de/board/post/132440/ 
%5Bmp2%5D_test_server_cannot_start_as_non- 
root_user_with_worker_mpm.html
Cory didn't followup on his proposal.

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Author  : Ron Grunwald
Position: IT Desktop Support Officer
Organisation: Edith Cowan University
Faculty : KITSC
Location: Mount Lawley, Western Australia
Email   : [EMAIL PROTECTED]
Alt. Email  : [EMAIL PROTECTED]
Telephone   : 9370 6168
Mobile Ph.  : 0419 041 786

"He who play with root will eventually kill tree !"


Re: Solved: Problem running 'make test' on MacOSX

2005-03-09 Thread Stas Bekman
Ron Grunwald wrote:
Hello Stas,
Thank you for your suggestion. I read through the thread as you  suggested,
and the underlying fault seems to be permissions related. I built  mod_perl
under my own login, which is an ADS network account, and noticed that  the
UID is a very large integer. I somehow thought that this could be  
contributing
to the problem and so decided to create a local user account on my  
MacOSX system.
This account lists much lower integers for UID and GID in the shell.

I rebuilt mod_perl under this new, local account and then ran 'make  test'.
It all ran sensationally well this time and all the tests passed.
Thank you for the pointer that planted the seed.
Excellent. Though if you have a bit of free time, as a service to other 
folks who will certainly hit the same problem, it'd be great if you could 
go back to the original problematic setup and figure out how Apache-Test 
could have avoided it in first place, or at worst knew how to signal to 
the user what exactly is the problem. We are here to help if you have any 
further questions. Thank you, Ron.

--
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


[mod_perl2] Apache::DBI Win2K

2005-03-09 Thread Tom Pfeifer




I have installed Apache-2.0.53, ActivePerl-5.8.6.811, Apache-DBI 0.94.

Anyone been successful at actually creating persistent database connections with the above setup, or something similar with Apache2, ActivePerl and Apache-DBI.  I find the Apache::DBI module to have a "require Apache" at the top.  Since this computer has never had Apache 1.x or mod_perl1, there is no Apache.pm available.  This tells me it has not been upgraded to Apache2.

Does Win2K, Apache2, ActivePerl require a completely different "set-up" for persistent database connections?

I read on http://perl.apache.org/docs/2.0/user/design/design.html#TIPool that this may be a replacement for persistent stuff.  I'm not a C programmer, so I don't know how to "hook" into the TIPool stuff.

My fall back is to use my OpenBSD server, but so many compaines are using Windows now I wanted to make sure I offer the Windows option.

Thanks in advance,

Tom