Re: apache children waits for each other?
On Aug 16, 2005, at 9:49 AM, Perrin Harkins wrote: If you can use Apache::Session::Memcached, why can't you use Apache::Session::MySQL with a common database login? That will mean one connection per apache process. You can also raise the connection limit on your database server if it isn't dying under the load. I do all of my memcached stuff , including sessions, with mysql failover. its barely more code - i just make every public function address two private functions. ie: sub save { $_[0]-_save_memcached(); $_[0]-_save_mysql(); } sub load { if ( !$_[0]-_load_memcached() ) { $_[0]-_load_mysql(); } }
Re: Mod_perl Apache to encapsulate legacy protocol
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is this what you are searching for: http://perl.apache.org/docs/2.0/user/handlers/protocols.html There are projects already online which use MP2 to implement their own protocol e.g. SMTP, ... . Tom Chris Werner wrote: I am in process of porting an existing cgi database application over to Mod_perl2 Apache [and learning Mod_perl at the same time]. I have moved all cgi scripts over to registry scripts and am working on moving to handlers. The app is a server listening for connections speaking a simple in-house developed protocol and logs information into a database for later display [and manipulation] by Apache based web pages. I had a thought of scrapping the exiting server, and using Apache as the server for both the incoming data and for the web page interface to the database. My question is: how to best set up Apache MP2 to accept a legacy protocol? Thank you, Christian Werner -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org iD8DBQFDAgXTkVPeOFLgZFIRAkWVAJ0dojYA9sP1S4JAVPL706YUtW7HJgCfaytZ pq2t6UKrigpJTQ5TSFF6cx4= =atYx -END PGP SIGNATURE-
Re: Mod_perl Apache to encapsulate legacy protocol
Tom Schindl wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is this what you are searching for: http://perl.apache.org/docs/2.0/user/handlers/protocols.html There are projects already online which use MP2 to implement their own protocol e.g. SMTP, ... . And sometimes you can extend the HTTP if your protocol is somewhat similar to it. e.g. send email over HTTP: http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlHeaderParserHandler -- __ 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: apache children waits for each other?
On Aug 16, 2005, at 11:17 AM, Perrin Harkins wrote: Good plan. This would make a nice addition (as a separate module) to the Apache::Session::Memcached distribution. I'll see if I can figure out how to make: Apache::Session::Memcached::WithFailover where it does that behavior, but then allows you to specify a specific Apache::Session datastore as being the failover device it shouldn't be all that hard - mostly aliasing function calls to existing modules.
Re: Adding Directives At Runtime
Frank Wiles wrote: On Tue, 16 Aug 2005 12:07:51 -0400 Christopher H. Laco [EMAIL PROTECTED] wrote: So, given a list of urls, is it possible to dynamically add Location /somemethod tags to Apache? I think so, I just don't know where to start. I think this is what you are looking for: http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl - Frank Wiles [EMAIL PROTECTED] http://www.wiles.org - Yes, and No. Read it. It seems to cover more of doing things like that in Perl sections. What I'm more curious is if it can be done during this phase: PerlModule MyCatalystApp What I don't yet grasp is if adding to the httpd.conf at runtime is limited to a particular phase of if I could have any mod_perl handler actually alter the http config while serving live requests. Could I have a mod_perl page whereby the user submits a form, that in turn added a Location directive to the runnin apache processes? -=Chris smime.p7s Description: S/MIME Cryptographic Signature
Re: Adding Directives At Runtime
Yes, and No. Read it. It seems to cover more of doing things like that in Perl sections. What I'm more curious is if it can be done during this phase: PerlModule MyCatalystApp yes. at least in mp1. see http://www.modperlcookbook.org/~geoff/modules/experimental/Apache-ReverseLocation-0.01.tar.gz for a bizarre yet working example of adding to the PerlSections namespace. fwiw, gozer tells me this is perfectly fine in mp2 as well. however, I have my doubts - PerlModule doesn't start the interpreter anymore, so you'd need to use PerlLoadModule to insert these into apache's config time. though I can't recall if we altered PerlLoadModule so it can be used without custom config directives (though I think gozer did that too). if not, you can trick the interpreter into starting with a dummy Perl section :) What I don't yet grasp is if adding to the httpd.conf at runtime is limited to a particular phase of if I could have any mod_perl handler actually alter the http config while serving live requests. well, you probably wouldn't want to do the latter - once you're serving a request it makes little sense to add a full Location or whatnot, since that directive would just disappear at the end of the request. you'd be better off just fiddling with the current request using stuff like $r-handler than thinking about how to add real httpd.conf directives at that point. Could I have a mod_perl page whereby the user submits a form, that in turn added a Location directive to the runnin apache processes? yes, through means like $r-handler and whatnot. not really in terms of Location, at least not that I know about. but as I said, you probably wouldn't want to do that anyway. --Geoff
Re: Adding Directives At Runtime
Geoffrey Young wrote: What I don't yet grasp is if adding to the httpd.conf at runtime is limited to a particular phase of if I could have any mod_perl handler actually alter the http config while serving live requests. well, you probably wouldn't want to do the latter - once you're serving a request it makes little sense to add a full Location or whatnot, since that directive would just disappear at the end of the request. you'd be better off just fiddling with the current request using stuff like $r-handler than thinking about how to add real httpd.conf directives at that point. Yah. I wouldn't want to do it either. It was more of a means to express the ability to alter config at a later runtime, versus doing it during the parse/load phase of the httpd.conf... Could I have a mod_perl page whereby the user submits a form, that in turn added a Location directive to the runnin apache processes? yes, through means like $r-handler and whatnot. not really in terms of Location, at least not that I know about. but as I said, you probably wouldn't want to do that anyway. --Geoff smime.p7s Description: S/MIME Cryptographic Signature
Re: Adding Directives At Runtime
On Tue, 16 Aug 2005 12:23:04 -0400 Christopher H. Laco [EMAIL PROTECTED] wrote: Yes, and No. Read it. It seems to cover more of doing things like that in Perl sections. What I'm more curious is if it can be done during this phase: PerlModule MyCatalystApp What I don't yet grasp is if adding to the httpd.conf at runtime is limited to a particular phase of if I could have any mod_perl handler actually alter the http config while serving live requests. Could I have a mod_perl page whereby the user submits a form, that in turn added a Location directive to the runnin apache processes? I know it's possible, I'm just not finding exactly the right part of the guide about this. For MP2 I believe you can use: http://perl.apache.org/docs/2.0/api/Apache2/Directive.html - Frank Wiles [EMAIL PROTECTED] http://www.wiles.org -
Re: Adding Directives At Runtime
On Tue, 2005-08-16 at 12:07 -0400, Christopher H. Laco wrote: There are various plugins and httpd.conf changes that can be made to disuade this behaviour, but I would like to take it a step further and make it Just Work(TM) so I don't have to tweak the httpd.conf or the static plugin every time I add a new static directory. If you put your catalyst app under a known path (i.e. /something instead of /), you wouldn't have to worry about that. Or you could just put all static files under /assets/ or similar. - Perrin
Mod_Perl 2.0 Header question
Hi, I was hoping to get a bit of help on how to send the proper HTTP headers using Mod_Perl. We create Perl scripts and then ship them out to our clients for them to run on their servers. The script should work on regular CGI and Mod_Perl if they have it. Things have worked fine so far. But now Mod_Perl 2.0 is starting to be installed on servers throughout the world and I need to modify my script so that it will work with it also. I only use Mod_Perl to speed up regular CGI using registry. I have a main.pl file that requires a helper.pl file. In the helper.pl I have the code that produces the HTTP header. It is in the helper.pl because both main.pl and main2.pl need it. My current code looks something like this: sub PrintHeader { my $strOut = ; my $blnModPerl = 0; my $intModPerlVersion = 0; my $strDefaultContentType = ; $strDefaultContentType .= Content-type: text/html\r\n\r\n; if (exists($ENV{'MOD_PERL'}) defined($ENV{'MOD_PERL'})) { $blnModPerl = 1; $intModPerlVersion = $ENV{'MOD_PERL'}; # Change mod_perl/1.XX to 1.X $intModPerlVersion =~ s/mod_perl\/(\d\.\d)(.*?)$/$1/i; } if ($ENV{'PERL_SEND_HEADER'} || ($blnModPerl == 0)) { $strOut = $strDefaultContentType; } else { my $r = Apache-request; $r-content_type('text/html'); #Only call send_http_header for mod_perl versions prior to (1.9) in the 1.26 series #Remember to update this in admin.pl too if ($intModPerlVersion 1.9) { $r-send_http_header; } } $authlib::blnPrintedHeaders = 1; return $strOut; } I find that this breaks under some versions of Mod_Perl 2.0. Im working with two older versions: 1.99_07-dev and 1.99_12 both on Linux machines. My confusion is how to send the proper 2.0 header. In my in-house version Apache-request; does not seem to work. The 2.0 documentation says use Apache2::RequestUtil but that does not work either. My clients version however works with Apache-request and Im confused as to why. The bottom line is I want to have a function like the one above that will work for CGI, mod_perl 1.0 and mod_perl 2.0. Id like this function to be in a common library (helper.pl) so that main1.pl and main2.pl can use it. From reading the documentation I realize that there is a function called handler() and that you can get a hold of $r somehow. So I tried it out and came up with something like this: use strict; my $ModPerlObj = @_[0]; main::main(); package main; sub main { authlib::Initialize($ModPerlObj); } This seems to work because as I understand it Mod_Perl wraps up the contents of main.pl and places it inside a function called handler( ). handler( ) then receives an Apache Object. So Im getting it using @_[0] and then passing it into my function. Is this bad practice? Any cons to doing it this way? I just want a simple way to create the header. Please help. Thanks, Justin
apache -X on win32 vs mod_perl
Hi, Apache/2.0.54 with mod_perl 2.0.1 on Windows Server 2003, mostly standard configuration using mod_perl like Location /script SetHandler perl-script PerlOptions +ParseHeaders PerlResponseHandler ModPerl::Registry /Location LoadFile d:/Perl/bin/perl58.dll LoadModule perl_module modules/mod_perl.so Now when launching Apache with -X or -DONE_PROCESS it works fine when accessing normal files but as soon as a client requests /script the web server will exit, no error message, nothing in the error_log, the .pid file is not removed, it basically crashes. Is this known and is there a work around? I ran into this when trying to use Apache::DProf which does not work when running without -X (it creates the output files but only writes the header), same for Apache::SmallProf; setting perl5opt=-d:DProf does work but it will only profile mod_perl startup code, not the scripts I'd be interested in. Mike Zelina reported similar problems 2 1/2 years ago to this list... Is Apache::DProf actually supposed to work without -X? If not, where should I report the crash bug above if I don't want to debug any of the code involved? :-) TIA, -- Björn Höhrmann · mailto:[EMAIL PROTECTED] · http://bjoern.hoehrmann.de Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Re: Mod_Perl 2.0 Header question
I find that this breaks under some versions of Mod_Perl 2.0. I’m working with two older versions: 1.99_07-dev and 1.99_12 both on Linux machines. You should really try to use at least RC 5+ My confusion is how to send the proper 2.0 header. In my in-house version Apache-request; does not seem to work. The 2.0 documentation says use Apache2::RequestUtil but that does not work either. My clients version however works with Apache-request and I’m confused as to why. Apache2::RequestUtil doesn't exist in the versions you mentioned. Its still called Apache::RequestUtil. http://perl.apache.org/docs/2.0/rename.html To answer your question though, I believe you could do something like this, *untested* unless ($ENV{GATEWAY_INTERFACE} =~ /Perl/) { ## CGI script or commandline if ($ENV{GATEWAY_INTERFACE} =~ /CGI/) { ## CGI } else { ## Commandline } } elsif ($ENV{MOD_PERL_API_VERSION} == 2) { ## mod_perl 2 RC 5 + } elsif (eval { require mod_perl } $mod_perl::VERSION 1.99) { ## mod_perl 1.9900 - 1.99022 which is RC4 } elsif ( $mod_perl::VERSION 1.99) { ## mod_perl 1.x } else { ## fatal error .. I don't think this will get hit } Also, to send content headers in at least mp2, you should be using i.e. $r-content_header('text/html'); END What doesn't kill us can only make us stronger. Nothing is impossible. Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198 Consultant / http://p6m7g8.net/Resume/ Senior Developer / Liquidity Services, Inc. http://www.liquidityservicesinc.com http://www.liquidation.com http://www.uksurplus.com http://www.govliquidation.com http://www.gowholesale.com
Re: apache -X on win32 vs mod_perl
Bjoern Hoehrmann wrote: Now when launching Apache with -X or -DONE_PROCESS it works fine when accessing normal files but as soon as a client requests /script the web server will exit, no error message, nothing in the error_log, the .pid file is not removed, it basically crashes. Is this known and is there a work around? No idea, don't use windows with mp, but I'm sure someone here will know. Is Apache::DProf actually supposed to work without -X? If not, where should I report the crash bug above if I don't want to debug any of the code involved? :-) According to the Apache:DB docs yes; but again, I don't know on Windows. Frank Wiles is the current maintainer, I would ask him. -- END What doesn't kill us can only make us stronger. Nothing is impossible. Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198 Consultant / http://p6m7g8.net/Resume/ Senior Developer / Liquidity Services, Inc. http://www.liquidityservicesinc.com http://www.liquidation.com http://www.uksurplus.com http://www.govliquidation.com http://www.gowholesale.com
Re: Adding Directives At Runtime
Perrin Harkins wrote: On Tue, 2005-08-16 at 12:07 -0400, Christopher H. Laco wrote: There are various plugins and httpd.conf changes that can be made to disuade this behaviour, but I would like to take it a step further and make it Just Work(TM) so I don't have to tweak the httpd.conf or the static plugin every time I add a new static directory. If you put your catalyst app under a known path (i.e. /something instead of /), you wouldn't have to worry about that. Or you could just put all static files under /assets/ or similar. - Perrin Of course, but that's not always the case. I see no reason setup situations should be constrainded like that when they don't have to be. smime.p7s Description: S/MIME Cryptographic Signature
RE: Mod_Perl 2.0 Header question
Perrin responded to my question below. His response works with what I'm trying to do. Let me know if you think this is a bad idea. On Tue, 2005-08-16 at 09:20 -0700, Justin Luster wrote: The way it relates is that in the previous code I was doing this: my $r = Apache-request; $r-content_type('text/html'); It seems that in Mod_Perl 2.0 this does not work. It has changed to this: Apache2::RequestUtil-request() And you need to set this in your conf: PerlOptions +GlobalRequest Read the porting guide: http://perl.apache.org/docs/2.0/user/porting/compat.html#C_Apache_E_gt_r equest_ From the documentation that I read it seems that Mod_Perl wraps up my main.pl code into a handler() function. The documentation then describes that it passes the ApacheObj as the 1st parameter to this function. That's correct, you can get it that way. So by doing this: my $ModPerlObj = @_[0]; I'm able to get that ApacheObj and pass it to my code. I don't think that I need it to be different for each request. No, you really do. When you create a closure, it keeps the first request that comes in and you will never be setting the content-type on any request after that. I expect it will fail and possibly cause memory problems. All you need to do to fix your code is to pass $r instead of making a closure: use strict; use warnings; my $r = shift; main::start($r); package main; sub start { my $r = shift; authlib::Initialize($r); } I'm not sure it's worth having the separate sub at all though, if that's all that's in it. We ship our code out to clients throughout the world. Because of this our code could be run on any type of Mod_Perl system. So it would be nice to find a method that would work with anything out there. It is frustrating that something as simple as this could not stay consistent across versions. You can't really expect your code to work on beta pre-release versions. People need to keep up to some degree if they want to use unstable code. The 2.0 release is stable, and the 1.x series is stable. Pre-release versions of 2.0 are totally unsupported. We generally do not rely on outside Perl libraries. We try to keep all of the code that our clients need wrapped up in our Perl files. This way we are not relying on the end computer as much. We do this too, by packaging all of the CPAN modules we use in a bundle that we compile and access locally, not from site_perl. Sorry, I'm not the Musician's Friend but I'm still a nice guy :) I remember your winning photo from last year. This year's was not as good. - Perrin -Original Message- From: Philip M. Gollucci [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 16, 2005 10:36 AM To: Justin Luster Cc: modperl@perl.apache.org Subject: Re: Mod_Perl 2.0 Header question I find that this breaks under some versions of Mod_Perl 2.0. I'm working with two older versions: 1.99_07-dev and 1.99_12 both on Linux machines. You should really try to use at least RC 5+ My confusion is how to send the proper 2.0 header. In my in-house version Apache-request; does not seem to work. The 2.0 documentation says use Apache2::RequestUtil but that does not work either. My clients version however works with Apache-request and I'm confused as to why. Apache2::RequestUtil doesn't exist in the versions you mentioned. Its still called Apache::RequestUtil. http://perl.apache.org/docs/2.0/rename.html To answer your question though, I believe you could do something like this, *untested* unless ($ENV{GATEWAY_INTERFACE} =~ /Perl/) { ## CGI script or commandline if ($ENV{GATEWAY_INTERFACE} =~ /CGI/) { ## CGI } else { ## Commandline } } elsif ($ENV{MOD_PERL_API_VERSION} == 2) { ## mod_perl 2 RC 5 + } elsif (eval { require mod_perl } $mod_perl::VERSION 1.99) { ## mod_perl 1.9900 - 1.99022 which is RC4 } elsif ( $mod_perl::VERSION 1.99) { ## mod_perl 1.x } else { ## fatal error .. I don't think this will get hit } Also, to send content headers in at least mp2, you should be using i.e. $r-content_header('text/html'); END What doesn't kill us can only make us stronger. Nothing is impossible. Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198 Consultant / http://p6m7g8.net/Resume/ Senior Developer / Liquidity Services, Inc. http://www.liquidityservicesinc.com http://www.liquidation.com http://www.uksurplus.com http://www.govliquidation.com http://www.gowholesale.com
Hanging apache child on fork
Hello. I'm having trouble with a new setup on a RedHat Entreprise Linux 4 box. The problem is that whenever there is perl code that fork to execute something, the apache child hang. The problem occur with a specific function is called. But the weird part is that the hang don't occur when that function is called; it happened later, when a call to an external program is made, like: my ($x, $y) = MyFunc(); # anything else $h = qx( /bin/hostname ); # hanged here. When it hang, it will show up is ps like this: $ ps axf [] 10002 ?Ss 0:00 /usr/local/apache_backend-1.3.33/bin/httpd 10003 ?S 0:00 \_ usr/local/apache_backend-1.3.33/bin/httpd 10004 ?S 0:00 \_ usr/local/apache_backend-1.3.33/bin/httpd 10042 ?S 0:00 \_ [hostname] If I strace the apache child, all I see is that the process is reading something, but hanged there. [...] clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7ff7708) = 10009 close(10) = 0 close(8)= 0 read(9, If I strace the hostname process, the process is released: the request continue, the output is sent, and the apache child is released. I've tried to isolate what it the function could cause or favorise the hang: the function is used to setup a session using Apache::Session on an NFS shared directory. I've added some return ({}, {}); here and there in the function to find a specific place. But the spot I've found is pretty weird... It is completely at the end of the function. return ($zzz, $xxx) ; # with fake data; will work return ($session, $params_cookie); # real data, will not work So, if a add a return with empty hash-ref, or fake value hashref, it is ok. But if I return the actual hashref, it will then hang later. This is running on Apache 1.3.33, mod_perl 1.29, on a dual-processor machine. Perl is 5.8.5, as shipped from RedHat. Apache and mod_perl is compiled, with mod_perl as a compiled-in module. The same code is running on 3 RHEL 3 without problems; it's only with RHEL4 that it does not work, with everything compiled the same way. Anyone have an idea what else I can test and/or try? -- Benoit Caron Administrateur système Canoe inc. I read the FM, and it didn't work. signature.asc Description: OpenPGP digital signature
mod_perl touted in company press release
http://home.businesswire.com/portal/site/google/index.jsp? ndmViewId=news_viewnewsId=20050816005237newsLang=en Increased Performance and Scalability with Mod_Perl: FootPrints 7.0 offers significantly improved performance and speed when a large number of agents are using the system. Mod_Perl versions are now available for UNIX(R) and Linux(R) platforms. Microsoft Windows versions will follow in Q4 2005. - Perrin
Re: Hanging apache child on fork
Benoit Caron wrote: Hello. I'm having trouble with a new setup on a RedHat Entreprise Linux 4 box. The problem is that whenever there is perl code that fork to execute something, the apache child hang. Have you read: http://perl.apache.org/docs/1.0/guide/performance.html#Forking_and_Executing_Subprocesses_from_mod_perl And looked into Apache::SubProcess ? http://search.cpan.org/dist/Apache-SubProcess/ 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: Adding Directives At Runtime
Christopher H. Laco wrote: Perrin Harkins wrote: On Tue, 2005-08-16 at 12:07 -0400, Christopher H. Laco wrote: There are various plugins and httpd.conf changes that can be made to disuade this behaviour, but I would like to take it a step further and make it Just Work(TM) so I don't have to tweak the httpd.conf or the static plugin every time I add a new static directory. If you put your catalyst app under a known path (i.e. /something instead of /), you wouldn't have to worry about that. Or you could just put all static files under /assets/ or similar. - Perrin Of course, but that's not always the case. I see no reason setup situations should be constrainded like that when they don't have to be. A sample example of what I _think_ you are trying to do would look like: httpd.conf PerlModule Catalyst /httpd.conf Catalyst.pm package Catalyst; use Apache2::ServerUtil qw(); [... figure out where/what to configure ...] Apache2::ServerUtil-server-add_config([ 'Location /foo-bar', ' SetHandler perl-script', ' PerlHandler Catalyst::Foo::Bar', ]); /Catalyst.pm With -add_config, you can just feed arbitrary chunks of config to httpd, so you are free to do whatever you need to do. 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: Mod_perl Apache to encapsulate legacy protocol
Title: RE: Mod_perl Apache to encapsulate legacy protocol One of these approaches should fit my need. Thank you, Christian Werner -Original Message- From: Stas Bekman [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 16, 2005 10:56 AM To: Tom Schindl Cc: Chris Werner; modperl@perl.apache.org Subject: Re: Mod_perl Apache to encapsulate legacy protocol Tom Schindl wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is this what you are searching for: http://perl.apache.org/docs/2.0/user/handlers/protocols.html There are projects already online which use MP2 to implement their own protocol e.g. SMTP, ... . And sometimes you can extend the HTTP if your protocol is somewhat similar to it. e.g. send email over HTTP: http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlHeaderParserHandler -- __ Stas Bekman JAm_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: Adding Directives At Runtime
Philippe M. Chiasson wrote: A sample example of what I _think_ you are trying to do would look like: httpd.conf PerlModule Catalyst /httpd.conf Catalyst.pm package Catalyst; use Apache2::ServerUtil qw(); [... figure out where/what to configure ...] Apache2::ServerUtil-server-add_config([ 'Location /foo-bar', ' SetHandler perl-script', ' PerlHandler Catalyst::Foo::Bar', ]); /Catalyst.pm With -add_config, you can just feed arbitrary chunks of config to httpd, so you are free to do whatever you need to do. Exactly. IS there an an equivilant in MP1? smime.p7s Description: S/MIME Cryptographic Signature
mod_perl2 bug report
1. Problem Description: I'm trying to install mod_perl2, but i've got a problem. I've successfully compiled apache 2.054, mod_perl2, and the next step is running 'make test' command into for mod_perl. During the tests i've an error: /home/asm/apache2054/bin/bin/httpd -d /usr/home/asm/soft/Apache/mod_perl-2.0.1/t -f /usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS using Apache/2.0.54 (prefork MPM) waiting 120 seconds for server to start: .Syntax error on line 12 of /usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf: Cannot load /usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so into server: /usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so: Undefined symbol apr_os_thread_current Could you help me to solve this problem ? 2. Used Components and their Configuration: *** mod_perl version 2.01 *** using /usr/home/asm/soft/Apache/mod_perl-2.0.1/lib/Apache2/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB = aprext MP_APXS= /usr/home/asm/apache2054/bin/bin/apxs MP_COMPAT_1X = 1 MP_DEBUG = 1 MP_GENERATE_XS = 1 MP_LIBNAME = mod_perl MP_TRACE = 1 MP_USE_DSO = 1 *** /home/asm/apache2054/bin/bin/httpd -V Server version: Apache/2.0.54 Server built: Aug 16 2005 14:11:55 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_FLOCK_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT=/home/asm/apache2054 -D SUEXEC_BIN=/home/asm/apache2054/bin/suexec -D DEFAULT_PIDLOG=logs/httpd.pid -D DEFAULT_SCOREBOARD=logs/apache_runtime_status -D DEFAULT_LOCKFILE=logs/accept.lock -D DEFAULT_ERRORLOG=logs/error_log -D AP_TYPES_CONFIG_FILE=conf/mime.types -D SERVER_CONFIG_FILE=conf/httpd.conf *** (apr|apu)-config linking info -L/home/asm/apache2054/bin/lib -laprutil-0 -ldb4 -lexpat -L/home/asm/apache2054/bin/lib -lapr-0 -lm -lcrypt *** /usr/local/bin/perl -V Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Platform: osname=freebsd, osvers=4.7-release, archname=i386-freebsd-thread-multi-64int uname='freebsd sspserver.dev 4.7-release freebsd 4.7-release #3: mon jun 2 17:20:39 msd 2003 [EMAIL PROTECTED]:usrsrcsyscompilesmp i386 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include', optimize='-O3', cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3.2', gccosandvers='freebsd4.7' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags ='-pthread -Wl,-E -L/usr/local/lib' libpth=/home/blackcat/gcc/lib /usr/lib /usr/local/lib libs=-lm -lcrypt -lutil -lc_r perllibs=-lm -lcrypt -lutil -lc_r libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_64_BIT_INT USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under freebsd Compiled at Dec 5 2003 17:22:48 %ENV: PERL_LWP_USE_HTTP_10=1 @INC: /usr/local/lib/perl5/5.8.2/i386-freebsd-thread-multi-64int /usr/local/lib/perl5/5.8.2 /usr/local/lib/perl5/site_perl/5.8.2/i386-freebsd-thread-multi-64int /usr/local/lib/perl5/site_perl/5.8.2 /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl/5.8 /usr/local/lib/perl5/site_perl/5.005 /usr/local/lib/perl5/site_perl . *** Packages of interest status: Apache2: - Apache2::Request : - CGI: 3.06 ExtUtils::MakeMaker: 6.21 LWP: 5.76, 5.76 mod_perl : - mod_perl2 : 2.01 3. This is the core dump trace: (if you get a core dump): [CORE TRACE COMES HERE] This report was generated by t/REPORT on Tue Aug 16 10:23:59 2005 GMT. -8-- End Bug Report --8--
Re: mod_perl2 bug report
During the tests i've an error: /home/asm/apache2054/bin/bin/httpd -d /usr/home/asm/soft/Apache/mod_perl-2.0.1/t -f /usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS using Apache/2.0.54 (prefork MPM) waiting 120 seconds for server to start: .Syntax error on line 12 of /usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf: Cannot load /usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so into server: /usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so: Undefined symbol apr_os_thread_current *** /usr/local/bin/perl -V Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Platform: osname=freebsd, osvers=4.7-release, archname=i386-freebsd-thread-multi-64int uname='freebsd sspserver.dev 4.7-release freebsd 4.7-release #3: mon jun 2 17:20:39 msd 2003 [EMAIL PROTECTED]:usrsrcsyscompilesmp i386 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Whats happened here is that your PERL is ithread enabled and thus mod_perl thinks it should be too. Unfortunately, the APR library you are linking against is not thread enabled (-lpthread or -llibc_r). BTW you don't want the latter, use -lpthread on FreeBSD. You might need to edit your /etc/libmap.conf file (see my previous posts on this) A _VERY_ likely reason as I am a freebsd guy myself, is that you've installed Subversion or some other port that installs apr. That apr is not threaded. The apr-1-config and apu-1-config binaries are in your path (/usr/local/bin). This causes the HTTPD build to link against the WRONG apr/apr util libraries. Later when mod_perl2 calls apxs to get the path for things, its given the wrong ones causing the error you see. The easiest solution for me is to temporarily move them out of your PATH during compilation or rename them temporarily. I'm surprised, that you didn't get this during the mod_perl2 compile as thats where I usually get it and smack myself. I'm tempted to add a note to the mp2 build page about this, but don't know exactly how to word it. -- END What doesn't kill us can only make us stronger. Nothing is impossible. Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198 Consultant / http://p6m7g8.net/Resume/ Senior Developer / Liquidity Services, Inc. http://www.liquidityservicesinc.com http://www.liquidation.com http://www.uksurplus.com http://www.govliquidation.com http://www.gowholesale.com
Re: apache children waits for each other?
Hi, I'm assuming that each client database is contained within the same MySQL server, and that you're not running 300 MySQL servers on different machines or different ports? Yes, why would I do that? If so, you can reuse the same connections, and just reference the different database in the query.So : select * from db1.table1 select * from db2.table1 When you connect and specify a database name, you're just specifying the default database. I don't know it's even possible in mysql. Its reference docs doesn't say that it is (http://dev.mysql.com/doc/mysql/en/join.html). Thanks... --- Badai Aqrandista Cheepy (?) _ REALESTATE: biggest buy/rent/share listings http://ninemsn.realestate.com.au
Re: [mp2] make test failure in t/api/access2
Michael G Schwern wrote: On Mon, Aug 15, 2005 at 05:54:53PM -0700, Stas Bekman wrote: Where does it go then? Are you sure you've applied the patch and the warn statement is there? Grepping the source tree the only instance of myip is in t/response/TestAPI/access2.pm which I put in there according to your instructions. 0 windhund /usr/local/src/CPAN/mod_perl-2.0.1$ rgrep 'myip' ./t/response/TestAPI/access2.pm:warn myip: , $r-connection-remote_ip, \n; t/response/TestAPI/access2.pm attached. Looks fine. Dunno why it doesn't end up in the right place. Do you load some module that overrides SIG{__WARN__}? In any case I've committed the fix I've posted earlier, so you shouldn't have this issue anymore. -- __ 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_perl2 bug report
Philip M. Gollucci wrote: During the tests i've an error: /home/asm/apache2054/bin/bin/httpd -d /usr/home/asm/soft/Apache/mod_perl-2.0.1/t -f /usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf -D APACHE2 -D PERL_USEITHREADS using Apache/2.0.54 (prefork MPM) waiting 120 seconds for server to start: .Syntax error on line 12 of /usr/home/asm/soft/Apache/mod_perl-2.0.1/t/conf/httpd.conf: Cannot load /usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so into server: /usr/home/asm/soft/Apache/mod_perl-2.0.1/src/modules/perl/mod_perl.so: Undefined symbol apr_os_thread_current *** /usr/local/bin/perl -V Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration: Platform: osname=freebsd, osvers=4.7-release, archname=i386-freebsd-thread-multi-64int uname='freebsd sspserver.dev 4.7-release freebsd 4.7-release #3: mon jun 2 17:20:39 msd 2003 [EMAIL PROTECTED]:usrsrcsyscompilesmp i386 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Whats happened here is that your PERL is ithread enabled and thus mod_perl thinks it should be too. Unfortunately, the APR library you are linking against is not thread enabled (-lpthread or -llibc_r). BTW you don't want the latter, use -lpthread on FreeBSD. You might need to edit your /etc/libmap.conf file (see my previous posts on this) Well, the diagnostics are not exactly correct, Philip. as the problem has little to do with perl having ithreads enabled. apr_os_thread_current is used only if APR_HAS_THREADS is defined. When mod_perl is being built it gets this define from the apr headers, as supplied by apxs. The problem happens because mod_perl finds one set of headers during the build, but a libapr from a different install gets loaded at run time. But the following solution should work :) A _VERY_ likely reason as I am a freebsd guy myself, is that you've installed Subversion or some other port that installs apr. That apr is not threaded. The apr-1-config and apu-1-config binaries are in your path (/usr/local/bin). This causes the HTTPD build to link against the WRONG apr/apr util libraries. Later when mod_perl2 calls apxs to get the path for things, its given the wrong ones causing the error you see. The easiest solution for me is to temporarily move them out of your PATH during compilation or rename them temporarily. I'm surprised, that you didn't get this during the mod_perl2 compile as thats where I usually get it and smack myself. I'm tempted to add a note to the mp2 build page about this, but don't know exactly how to word it. -- __ 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 touted in company press release
Perrin Harkins wrote: http://home.businesswire.com/portal/site/google/index.jsp? ndmViewId=news_viewnewsId=20050816005237newsLang=en Increased Performance and Scalability with Mod_Perl: FootPrints 7.0 offers significantly improved performance and speed when a large number of agents are using the system. Mod_Perl versions are now available for UNIX(R) and Linux(R) platforms. Microsoft Windows versions will follow in Q4 2005. Cool, can we link to that release from somewhere? also that reminds me that we still haven't done the press release for 2.0 release (hint, hint :) -- __ 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_perl2 bug report
Stas Bekman wrote: Philip M. Gollucci wrote: Well, the diagnostics are not exactly correct, Philip. as the problem has little to do with perl having ithreads enabled. apr_os_thread_current is used only if APR_HAS_THREADS is defined. When mod_perl is being built it gets this define from the apr headers, as supplied by apxs. The problem happens because mod_perl finds one set of headers during the build, but a libapr from a different install gets loaded at run time. I've never said that right yet. *sigh* Thanks. -- END What doesn't kill us can only make us stronger. Nothing is impossible. Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198 Consultant / http://p6m7g8.net/Resume/ Senior Developer / Liquidity Services, Inc. http://www.liquidityservicesinc.com http://www.liquidation.com http://www.uksurplus.com http://www.govliquidation.com http://www.gowholesale.com
Re: apache children waits for each other?
I also suspect that you didn't initialize the debugger before compiling your code, since none of your code appears in this output. I got the previous output because I put in the debugger initialization... Without initialization (Apache::DB-init), this is the top 5 output before the cache is filled (with dprofpp -r): Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 33.5 23.74 5.224 1 23.747 5.2236 ELRes::ApacheHandler::handler 1.09 0.772 0.772 7869 0.0001 0.0001 Storable::mretrieve 0.87 0.615 0.615 1418 0.0004 0.0004 Storable::net_mstore 0.70 0.495 0.495 1524 0.0003 0.0003 DBD::mysql::db::_login 0.54 0.380 0.380 2902 0.0001 0.0001 DBI::_new_sth 0.51 0.359 0.388 8852 0. 0. DBI::common::DESTROY and this one is after it's filled: Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 16.5 13.85 14.780 1 13.857 14.780 ELRes::ApacheHandler::handler 0.21 0.174 0.174 34766 0. 0. Date::Simple::DESTROY 0.20 0.170 0.170 6580 0. 0. Storable::mretrieve 0.19 0.162 0.162 99576 0. 0. Date::Simple::as_iso 0.14 0.115 0.115 27854 0. 0. Date::Simple::_add 0.11 0.090 0.090 25 0.0036 0.0036 DBD::mysql::db::_login How should I interpret these outputs and what should I do about it to improve my app's speed? This is the first time for me to optimize a large perl codebase... So I need a bit of guidance here... Thanks a lot... --- Badai Aqrandista Cheepy (?) _ Your opinion counts..for your chance to win a Mini Cooper click here http://www.qualifiedopinions.com/joinup.php?source=hotmail
Re: apache children waits for each other?
I do all of my memcached stuff , including sessions, with mysql failover. its barely more code - i just make every public function address two private functions. ie: sub save { $_[0]-_save_memcached(); $_[0]-_save_mysql(); } sub load { if ( !$_[0]-_load_memcached() ) { $_[0]-_load_mysql(); } } I thought about the same thing last night, but is there any race condition problem if I use it for session? --- Badai Aqrandista Cheepy (?) _ SEEK: Over 80,000 jobs across all industries at Australia's #1 job site. http://ninemsn.seek.com.au?hotmail
Re: apache children waits for each other?
On Wed, 2005-08-17 at 09:23 +1000, Badai Aqrandista wrote: I got the previous output because I put in the debugger initialization... Was the previous output sorted with the -r flag though? It just seems so unlikely that Params::Validate would take significant time. If it was sorted with -r, it looks like your use of memcached is working against you. Maybe you have a slow network connection to the memcached server, or are just storing too much in it. I'd suggest you look into using a local cache instead, like Cache::FastMmap. This will be faster, although the cache will not be shared between machines. Without initialization (Apache::DB-init) No point in looking at that. It's missing most of your code. How should I interpret these outputs and what should I do about it to improve my app's speed? This is the first time for me to optimize a large perl codebase... So I need a bit of guidance here... There's no trick, it's the same as in any language: find out what the slow parts are by using a profiler and tinker with them until they are faster. You can look at the tuning information on http://modperlbook.org/ for some advice as well. And don't forget that there is a profiler for DBI queries that comes with DBI. - Perrin
Re: apache children waits for each other?
Was the previous output sorted with the -r flag though? No. There's no trick, it's the same as in any language: find out what the slow parts are by using a profiler and tinker with them until they are faster. You can look at the tuning information on http://modperlbook.org/ for some advice as well. And don't forget that there is a profiler for DBI queries that comes with DBI. I've done the database profiling as well... Thanks for your help... --- Badai Aqrandista Cheepy (?) _ REALESTATE: biggest buy/rent/share listings http://ninemsn.realestate.com.au
Re: apache children waits for each other?
On Wed, 2005-08-17 at 10:15 +1000, Badai Aqrandista wrote: Was the previous output sorted with the -r flag though? No. Okay, send it again with the top 10, sorted by -r then. Maybe we can make more suggestions. - Perrin
Re: mod_perl touted in company press release
On Tue, 16 Aug 2005 16:14:56 -0700 Stas Bekman [EMAIL PROTECTED] wrote: Perrin Harkins wrote: http://home.businesswire.com/portal/site/google/index.jsp? ndmViewId=news_viewnewsId=20050816005237newsLang=en Increased Performance and Scalability with Mod_Perl: FootPrints 7.0 offers significantly improved performance and speed when a large number of agents are using the system. Mod_Perl versions are now available for UNIX(R) and Linux(R) platforms. Microsoft Windows versions will follow in Q4 2005. Cool, can we link to that release from somewhere? also that reminds me that we still haven't done the press release for 2.0 release (hint, hint :) I'm up for helping with the press release and or getting it out to media outlets. Let me know if you need some help. - Frank Wiles [EMAIL PROTECTED] http://www.wiles.org -
Re: apache children waits for each other?
Okay, send it again with the top 10, sorted by -r then. Maybe we can make more suggestions. Exclusive Times %Time ExclSec CumulS #Calls sec/call Csec/c Name 20.5 14.30 15.222 1 14.305 15.222 ELRes::ApacheHandler::handler 0.37 0.261 0.261 99576 0. 0. Date::Simple::as_iso 0.22 0.151 0.153 20364 0. 0. Params::Validate::_check_regex_fro m_xs 0.17 0.117 0.117 6580 0. 0. Storable::mretrieve 0.13 0.093 0.093 27854 0. 0. Date::Simple::_add 0.09 0.065 0.065 2900 0. 0. ELRes::Entity::DESTROY 0.08 0.058 0.058 34766 0. 0. Date::Simple::DESTROY 0.08 0.054 0.054 41678 0. 0. Date::Simple::_compare 0.05 0.035 0.035 12984 0. 0. Date::Simple::__ANON__ 0.03 0.020 0.020 36 0.0006 0.0005 Template::Context::filter 0.03 0.019 0.019102 0.0002 0.0002 DBI::common::DESTROY 0.01 0.010 0.010 1 0.0100 0.0100 DynaLoader::bootstrap 0.01 0.010 0.010 1 0.0100 0.0100 ELRes::App::Session::DESTROY 0.01 0.010 -0.000 2 0.0050 - ELRes::ApacheHandler::trans_handle 0. r 0.01 0.010 0.010 25 0.0004 0.0004 DBD::mysql::db::_login As I said previously, the handler itself tops everything... I don't know why it happens... If I use Devel::Timer to profile its parts, I found that this block takes the most time to run (99.98%): eval { $app-run }; if ($@) { $r-log_error(Server error: $@); $app-send_error(err = $@); } But the call should not be included in the handler's ExclSec time, shouldn't it? The eval doesn't make the call included in the ExclSec time because I've tested without it and it still use 99.98% of the time... Wierd eh? Thanks a lot... --- Badai Aqrandista Cheepy (?) _ Sell your car for $9 on carpoint.com.au http://www.carpoint.com.au/sellyourcar
Re: apache children waits for each other?
Badai Aqrandista wrote: As I said previously, the handler itself tops everything... I don't know why it happens... It does look odd. Maybe you are still loading some code before calling Apache::DB-init(). Can you post your httpd.conf, or at least the mod_perl part of it? If I use Devel::Timer to profile its parts, I found that this block takes the most time to run (99.98%): eval { $app-run }; if ($@) { $r-log_error(Server error: $@); $app-send_error(err = $@); } That's pretty much the whole thing, isn't it? But the call should not be included in the handler's ExclSec time, shouldn't it? That's why I think you are loading some code before initializing the debugger -- when it doesn't know about those other subs, they don't show up in the profile. - Perrin
Re: apache children waits for each other?
It does look odd. Maybe you are still loading some code before calling Apache::DB-init(). Can you post your httpd.conf, or at least the mod_perl part of it? start of mod_perl configuration ... Perl use lib '/i4u/web/elres-mp'; #require Apache::DB; #Apache::DB-init; /Perl PerlRequire /i4u/web/elres-mp/etc/startup.pl PerlModule Apache::DProf PerlModule ELRes::ELRes PerlModule ELRes::ApacheHandler PerlTransHandler ELRes::ApacheHandler-trans_handler PerlLogHandler ELRes::ApacheHandler-log_handler PerlCleanupHandler ELRes::ApacheHandler-cleanup_handler ... end mod_perl configuration ... the startup.pl script loads and require's all modules under ELRes:: namespace on startup time, as suggested in mod_perl documentation... eval { $app-run }; if ($@) { $r-log_error(Server error: $@); $app-send_error(err = $@); } That's why I think you are loading some code before initializing the debugger -- when it doesn't know about those other subs, they don't show up in the profile. the object that $app refer to is dynamically decided based on the hostname, for example: a.example.com --- $app = ELRes::Property-new() b.example.com --- $app = ELRes::Property-new() c.example.com --- $app = ELRes::Distributor-new() both ELRes::Property and ELRes::Distributor are children of ELRes::TopLevelEntity and have run() method... does this prevents the debugger to know which subroutine should be profiled? all the test that I've done is on the hostname whose object is of class ELRes::Property... Anyway, Hmmm... Where can I learn more about the debugger? I didn't know profiling needs debugger, not until I was told about it in this mailinglist... Cheers... --- Badai Aqrandista Cheepy (?) _ SEEK: Over 80,000 jobs across all industries at Australia's #1 job site. http://ninemsn.seek.com.au?hotmail
Re: apache children waits for each other?
Badai Aqrandista wrote: Perl use lib '/i4u/web/elres-mp'; #require Apache::DB; #Apache::DB-init; /Perl PerlRequire /i4u/web/elres-mp/etc/startup.pl PerlModule Apache::DProf PerlModule ELRes::ELRes PerlModule ELRes::ApacheHandler PerlTransHandler ELRes::ApacheHandler-trans_handler PerlLogHandler ELRes::ApacheHandler-log_handler PerlCleanupHandler ELRes::ApacheHandler-cleanup_handler This looks okay, assuming those lines were not commented out when you ran it. the startup.pl script loads and require's all modules under ELRes:: namespace on startup time, as suggested in mod_perl documentation... Why do you have those two PerlModule calls then? I suggest taking them out. If that breaks anything, it means your startup.pl is not doing what you think it is. the object that $app refer to is dynamically decided based on the hostname, for example: a.example.com --- $app = ELRes::Property-new() b.example.com --- $app = ELRes::Property-new() c.example.com --- $app = ELRes::Distributor-new() both ELRes::Property and ELRes::Distributor are children of ELRes::TopLevelEntity and have run() method... does this prevents the debugger to know which subroutine should be profiled? No, it won't make a difference. Hmmm... Where can I learn more about the debugger? There is information about it in the perl man pages (man perldebug), in Programming Perl, and in various articles on the web. I didn't know profiling needs debugger, not until I was told about it in this mailinglist... Apache::DProf uses the debugger hooks. You can also try Sam Tregar's Devel::Profiler::Apache which is somewhat slower but easier to use since it doesn't use the debugger. - Perrin
Re: apache children waits for each other?
Apache::DProf uses the debugger hooks. You can also try Sam Tregar's Devel::Profiler::Apache which is somewhat slower but easier to use since it doesn't use the debugger. I'll look into that... Thanks for your suggestions... --- Badai Aqrandista Cheepy (?) _ REALESTATE: biggest buy/rent/share listings http://ninemsn.realestate.com.au
Re: win32, mod_perl/2.0.1, Apache/2.0.54 - ithreads problem
On Fri, 5 Aug 2005, Plymouth Rock wrote: Could you post a complete (but minimal) script that illustrates the problem you're encountering? From what you wrote above, I tried this Registry script: Here is a simplest ithread-based perl-script I'd testing. At first, run it just with Perl (or, it's desirable, on win32-platform with ActivePerl), look at results. Then try the same with mod_perl2. I suspect you won't see any results at all or you will be able to see incorrect results via great delay. #!C:\Perl\bin\perl -w print Content-type: text/html\n\n; use strict; use warnings; use Time::HiRes; use threads; use threads::shared; use Thread::Queue; my ($doc_top, $doc_middle, $doc_bottom); my $threads = 3; my $itable; $doc_top = html\n; $doc_top .= head\n; $doc_top .= script\n; $doc_top .= function set(id,text) {\n; $doc_top .= document.getElementById(id).innerText = text\n; $doc_top .= }\n; $doc_top .= /script\n\n; $doc_top .= /head\n; $doc_top .= body\n\n; $doc_top .= table style=\font: 8pt Verdana, Arial, Helvetica, Sans-serif; line-height:8pt;\ cellSpacing=\1\ cellPadding=\2\ width=\21%\ border=\1\\n; $doc_top .= \ttr\n; $doc_top .= \t\ttd\n; $doc_middle =''; $doc_bottom .= \t\t/td\n; $doc_bottom .= \t/tr\n; $doc_bottom .= /table\n\n; for ($itable = 0; $itable = 98; $itable++) { $doc_middle .= \t\t\ttr\n if $itable%$threads == 0; $doc_middle .= \t\t\t\ttd width=\10%\ id='cell$itable' bgColor=\#ee\ align=\center\nbsp/td\n; $doc_middle .= \t\t\t/tr\n if $itable%$threads - ($threads - 1) == 0 || $itable = 98; } print $doc_top.$doc_middle.$doc_bottom; print font style=\font: 8pt Verdana, Arial, Helvetica, Sans-serif; line-height:8pt;\\n; $|++; my $q_letters = new Thread::Queue; my $q_pauses = new Thread::Queue; my $q_rvalues = new Thread::Queue; $q_letters-enqueue('a','b','c', 'd','e','f', 'g','h','i'); $q_pauses-enqueue ( (rand(1))+.3, (rand(1))+.3, (rand(1))+.3, (rand(1))+.3, (rand(1))+.3, (rand(1))+.3, (rand(1))+.3, (rand(1))+.3, (rand(1))+.3 ); $q_rvalues-enqueue ( int(rand(4))+2, int(rand(4))+2, int(rand(4))+2, int(rand(4))+2, int(rand(4))+2, int(rand(4))+2, int(rand(4))+2, int(rand(4))+2, int(rand(4))+2 ); my $count : shared = $threads; my @threads; sub fun { $count -= 1; my $pos; my $cur_var = 0; my $left_rval; my $left_letter; my $left_pause; my $scal = scalar(@threads); my $rval = $q_rvalues-dequeue; my $letter = $q_letters-dequeue; my $pause = $q_pauses-dequeue; for($cur_var = $cur_var; $cur_var = $rval; $cur_var++) { redo if $count; $pos = $cur_var*$threads + $scal; print scriptset('cell$pos', '$letter')/script\n; Time::HiRes::sleep($pause); if($cur_var == $rval) { $left_rval = $q_rvalues-pending; $left_letter = $q_letters-pending; $left_pause = $q_pauses-pending; if($left_rval 0 $left_letter 0 $left_pause 0) { $rval = $q_rvalues-dequeue + $cur_var; $letter = $q_letters-dequeue; $pause = $q_pauses-dequeue; } } } } foreach(1..$threads) { push @threads, threads-new(\fun) } foreach(1..$threads) { my $thid = shift @threads; $thid-join } print /body\n; print /html\n; As a registry script, you have some variable will not stay shared warnings in this (as you indicated in the original message). This type of thing is discussed at http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my___Scoped_Variable_in_Nested_Subroutines Does it help any if you get rid of these warnings (eg, declare appropriate variables with our). -- best regards, randy
svn commit: r233075 - /perl/modperl/trunk/t/response/TestAPI/access2.pm
Author: stas Date: Tue Aug 16 16:03:56 2005 New Revision: 233075 URL: http://svn.apache.org/viewcvs?rev=233075view=rev Log: adjust the test not to rely on @servername@ which for some reason mismatches on the some setups (making mod_auth fail). so instead use the 'allow from all' test, which should be still good enough for $r-satisfies test Modified: perl/modperl/trunk/t/response/TestAPI/access2.pm Modified: perl/modperl/trunk/t/response/TestAPI/access2.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/response/TestAPI/access2.pm?rev=233075r1=233074r2=233075view=diff == --- perl/modperl/trunk/t/response/TestAPI/access2.pm (original) +++ perl/modperl/trunk/t/response/TestAPI/access2.pm Tue Aug 16 16:03:56 2005 @@ -98,9 +98,7 @@ IfModule @ACCESS_MODULE@ # needed to test $r-satisfies -Order Deny,Allow -Deny from all -Allow from @servername@ +Allow from All /IfModule AuthType Basic AuthName Access