Re: loss of shared memory in parent httpd
Stas Bekman wrote: > Bill Marrs wrote: > >>> One more piece of advice: I find it easier to tune memory control >>> with a single parameter. Setting up a maximum size and a minumum >>> shared size is not as effective as setting up a maximum *UNSHARED* >>> size. After all, it's the amount of real memory being used by each >>> child that you care about, right? Apache::SizeLimit has this now, >>> and it would be easy to add to GTopLimit (it's just $SIZE - >>> $SHARED). Doing it this way helps avoid unnecessary process turnover. >> >> >> >> I agree. For me, with my ever more bloated Perl code, I find this >> unshared number to be easier to keep a lid on. I keep my apache >> children under 10MB each "unshared" as you say. That number is more >> stable that the SIZE/SHARED numbers that GTopLimmit offers. But, I >> have the GTopLimit sources, so I plan to tweak them to allow for an >> unshared setting. I think I bugged Stas about this a year ago and he >> had a reason why I was wrong to think this way, but I never understood >> it. > > > I don't remember why I was argueing against it :) But in any case, > I'll simply add this third option, so you can control it by either > SIZE/SHARED or UNSHARED. it's on CPAN now. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
[ANNOUNCE] Apache::GTopLimit v1.01
The uploaded file Apache-GTopLimit-1.01.tar.gz has entered CPAN as file: $CPAN/authors/id/S/ST/STAS/Apache-GTopLimit-1.01.tar.gz size: 5689 bytes md5: b2a6fc6b0ea01c6310b8e41480705486 Changes: =head1 ver 1.01 Thu Mar 14 13:53:16 SGT 2002 * add an unshared memory threshold, similar to Apache::SizeLimit * improve the debug mode testing whether at least one threshold was set * cache the previously fetched shared and/or size for reuse in the unshared memory calculation, which makes things a bit faster. * update docs I'll update the guide soonish. _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Blank Pages ( Revisited )
On Wed, Mar 13, 2002 at 06:07:01AM +, [EMAIL PROTECTED] wrote: > In the past someone posted a problem with mod_perl and DbI giving blank > pages from a SQL query. I did some digging around and found some info but I > need someone to fill in the holes for me a little. > > I created a DB Table "webtest". In the table, I filled it with the contents > of /usr/local/dict/propernames. Fine! it worked beautifully. > > However, when I do a "random" query I get some blank pages. I traced this to > the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". I found that sometimes > the "execute()" returns "0E0". Does anybody knows why?? > > I did a simple logic to check for the value return by "execute()", if the > value is "0E0" then do the same query. Do this same query until the value > return by "execute()" is not "0E0". However, I am still getting blank pages. > SELECT queries return 0E0 from execute() to indicate success, because the actual number of rows is not known until you fetch them. UPDATE and DELETE queries return 0E0 from execute() when the execution was successful but no rows were affected. You're probably getting a blank page because no row is being found. This could happen if there are gaps in ids in the table. It could also happen if rand() returns a number close to 1, because you're using ROUND() when you should be using TRUNC(). Also, the logic in this section of the code does not make sense: > 17 my $RowHandlesth = $DBH->prepare("SELECT * FROM webtest WHERE id = >ROUND( (RAND() * ?) + 1)"); > 18 $RowHandlesth->execute($id); > 19 > 20 while (! $RowHandlesth ) { > 21 $RowHandlesth->execute($id); If $RowHandlesth is false, it's because prepare() returned undef. You can't call a method on the undefined value. On the other hand, at least this will cause a fatal error; otherwise you would have an infinite loop, because once you enter the loop $RowHandlesth will never become true. > 22 > 23 if ( $RowHandlesth ) { You entered the loop because $RowHandlesth was false, and you haven't changed it's value since entering the loop. How could it be true all of a sudden? > 24 # my @row = $RowHandlesth->fetchrow; If this line were not commented out, you would be assigning to a lexical @row which would go out of scope right after. > 25 last; > 26 } > 27 } > 28 my @row = $RowHandlesth->fetchrow; Ronald
Re: Blank Pages ( Revisited )
> However, when I do a "random" query I get some blank > pages. I traced this to > the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". > I found that sometimes > the "execute()" returns "0E0". Does anybody knows > why?? If I remember rightly 0E0, in DBI, means "Success" ie : your query worked, but no rows were affected/returned. If there had been an error, "undef" would be returned. So for some reason your query is returning no rows. Can't immediately see why. (0E0 is evaluated as TRUE in a Boolean statement, "undef" as false.) HTH Henry > > I did a simple logic to check for the value return > by "execute()", if the > value is "0E0" then do the same query. Do this same > query until the value > return by "execute()" is not "0E0". However, I am > still getting blank pages. > > I am sending the actual script that I have been > working on to provide a > complete picture. > > Thank you in advanced > > -max > SCRIPT== > 1 package DBNE2; > 2 > 3 use strict; > 4 use vars qw($DBH); > 5 use Apache; > 6 use DBI(); > 7 > 8 sub handler { > 9 $DBH = > DBI->connect("DBI:mysql:test","webuser","mult1scan") > > || die $DBH->errstr; > 10 my $r = shift; > 11 my $h = > $DBH->trace(2,"/tmp/DBNE2.log"); > 12 > 13 my $IdHandle = $DBH->prepare("SELECT > MAX(id) FROM webtest"); > 14 $IdHandle->execute; > 15 my $id = $IdHandle->fetchrow; > 16 > 17 my $RowHandlesth = > $DBH->prepare("SELECT * FROM webtest WHERE > id = ROUND( (RAND() * ?) + 1)"); > 18 $RowHandlesth->execute($id); > 19 > 20 while (! $RowHandlesth ) { > 21 $RowHandlesth->execute($id); > 22 > 23 if ( $RowHandlesth ) { > 24 # my @row = > $RowHandlesth->fetchrow; > 25 last; > 26 } > 27 } > 28 my @row = $RowHandlesth->fetchrow; > 29 > 30 $r->content_type("text/html"); > 31 $r->send_http_header; > 32 $r->print(@row); > 33 $RowHandlesth->finish; > 34 } > 35 > 36 1; __ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com
Re: Blank Pages ( Revisited )
On Wed, 13 Mar 2002 [EMAIL PROTECTED] wrote: > Date: Wed, 13 Mar 2002 06:07:01 GMT > From: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Blank Pages ( Revisited ) > > In the past someone posted a problem with mod_perl and DbI giving blank > pages from a SQL query. I did some digging around and found some info but I > need someone to fill in the holes for me a little. > > I created a DB Table "webtest". In the table, I filled it with the contents > of /usr/local/dict/propernames. Fine! it worked beautifully. > > However, when I do a "random" query I get some blank pages. I traced this to > the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". I found that sometimes > the "execute()" returns "0E0". Does anybody knows why?? > > I did a simple logic to check for the value return by "execute()", if the > value is "0E0" then do the same query. Do this same query until the value > return by "execute()" is not "0E0". However, I am still getting blank pages. > > I am sending the actual script that I have been working on to provide a > complete picture. > > Thank you in advanced A floating point "0" or 0E0 is sometimes returned since it will test as True, when then number is unknown. Someone who undersands DBI's innards may comment on if this is the case here. > > -max > SCRIPT== > 1 package DBNE2; > 2 > 3 use strict; > 4 use vars qw($DBH); > 5 use Apache; > 6 use DBI(); > 7 > 8 sub handler { > 9 $DBH = DBI->connect("DBI:mysql:test","webuser","mult1scan") > || die $DBH->errstr; > 10 my $r = shift; > 11 my $h = $DBH->trace(2,"/tmp/DBNE2.log"); > 12 > 13 my $IdHandle = $DBH->prepare("SELECT MAX(id) FROM webtest"); > 14 $IdHandle->execute; > 15 my $id = $IdHandle->fetchrow; > 16 > 17 my $RowHandlesth = $DBH->prepare("SELECT * FROM webtest WHERE > id = ROUND( (RAND() * ?) + 1)"); > 18 $RowHandlesth->execute($id); > 19 > 20 while (! $RowHandlesth ) { > 21 $RowHandlesth->execute($id); > 22 > 23 if ( $RowHandlesth ) { > 24 # my @row = $RowHandlesth->fetchrow; > 25 last; > 26 } > 27 } > 28 my @row = $RowHandlesth->fetchrow; > 29 > 30 $r->content_type("text/html"); > 31 $r->send_http_header; > 32 $r->print(@row); > 33 $RowHandlesth->finish; > 34 } > 35 > 36 1; > Sincerely, William Mussatto, Senior Systems Engineer CyberStrategies, Inc ph. 909-920-9154 ext. 27
Re: Exiting a script, or how do you do exit?
Brian Lavender wrote: > Found the FAQ's. Seems that I can put in > > goto END; > > and then put an end block in the code. > > END: { > 1; > } no, you use exit() as is with Registry and Apache::exit with handlers. see: http://perl.apache.org/guide/porting.html#Terminating_requests_and_process > On Wed, Mar 13, 2002 at 07:07:18PM -0800, Brian Lavender wrote: > >>I developing some code, which I am running under >> >>Apache::Registry >> >>I seem to recall that you don't want to put >> >>exit; >> >>in a script, because the script continues to run. I have some >>code, where I may send a redirect, and then I am done. Is there >>a pseudo exit, or return command? >> >>brian >>-- >>Brian Lavender >>http://www.brie.com/brian/ >> > -- _ Stas Bekman JAm_pH -- Just Another mod_perl Hacker http://stason.org/ mod_perl Guide http://perl.apache.org/guide mailto:[EMAIL PROTECTED] http://ticketmaster.com http://apacheweek.com http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
Re: Exiting a script, or how do you do exit?
Found the FAQ's. Seems that I can put in goto END; and then put an end block in the code. END: { 1; } On Wed, Mar 13, 2002 at 07:07:18PM -0800, Brian Lavender wrote: > I developing some code, which I am running under > > Apache::Registry > > I seem to recall that you don't want to put > > exit; > > in a script, because the script continues to run. I have some > code, where I may send a redirect, and then I am done. Is there > a pseudo exit, or return command? > > brian > -- > Brian Lavender > http://www.brie.com/brian/ -- Brian Lavender http://www.brie.com/brian/
Exiting a script, or how do you do exit?
I developing some code, which I am running under Apache::Registry I seem to recall that you don't want to put exit; in a script, because the script continues to run. I have some code, where I may send a redirect, and then I am done. Is there a pseudo exit, or return command? brian -- Brian Lavender http://www.brie.com/brian/
RE: Mapping files
Well, I was able to do it nicely with a sub-request after calling 'lookup_filename'. I will still be picking up a copy of the cookbook though : ) > > I am trying to map a uri to a file based on certain factors. I > would like > > to have this done after the 'Trans' phase when certain information is > > available. I noticed when the original file mapping does not > exist (what > > apache maps in it's 'Trans' phase) the 'content_type' method > does not return > > a value. > > > it shouldn't. mod_mime needs the filename the URI maps to in > order to determine > the MIME type.
Re: open3 and mod_perl
Rasoul Hajikhani wrote: > Hello folks, > I am writing a web interface for the GPGP module that would allow users > to create a new public and private key and adds them to the corporate > key ring. I will be useing IPC::Open3 and IO::Select to "control" stdin > and stdout of GPGP. Are there any issues that I should be aware w/ these > packages under mod_perl? Any suggestions and comments would be greatly > welcomed. > Thanks in advance I don't use IPC::Open3, but this is still in the STATUS file http://marc.theaimsgroup.com/?l=apache-modperl&m=98839218229712&w=2 marc seems to be down at the moment, so this might be the same report (I can't remember) http://mathforum.org/epigone/modperl/dwoxmixsnen HTH --Geoff
Re: If mod_perl module loaded from within httpd.conf
George Sanderson wrote: > What is the best way to check from within the httpd.conf file if a mod_perl > module is loaded. For C modules, I can use: > ... > to conditionally load it's directives. > Is there a similar conditional syntax for the mod_perl script modules? > I only want a module's directives to be processed when that module is loaded. you can use the module() method from the Apache class to test for either a C module or a Perl one. $foo if Apache->module('mod_perl.c'); $foo if Apache->module('My::Module'); see recipe 4.2 in the cookbook for a few examples, including how to use it from a section in your httpd.conf --Geoff
Re: Mapping files
Stathy G. Touloumis wrote: > Hi, > > I am trying to map a uri to a file based on certain factors. I would like > to have this done after the 'Trans' phase when certain information is > available. I noticed when the original file mapping does not exist (what > apache maps in it's 'Trans' phase) the 'content_type' method does not return > a value. it shouldn't. mod_mime needs the filename the URI maps to in order to determine the MIME type. HTH --Geoff
[OT] File Upload Applet
Hey all, sorry for the semi-off-topic post, but this seemed like the most appropriate place. I've developed a web-based content management system, and am now starting to improve it's usability features. Users can upload documents (XSL, PDF, Images, etc), but the standard HTML Upload form field is pretty limiting (ever tried to upload 30+ images one at a time? Its painful work, I can tell you). What I'm looking for is a Java Applet (or something similar) that will provide a file browse dialog similar to what you'd find in a native file browser (or FTP client) to allow the user to select which files they'd like to upload. It would then upload (either using a MultiPart form submission, FTP, etc) those files to the server. Any suggestions? -- -man Michael A Nachbaur PGP Public Key at http://www.nachbaur.com/pgpkey.asc PGP Key fingerprint = 83DC 7C3A 3084 6A21 9A3F 801E D974 AFB4 BFD7 2B6F
RE: Mapping files
> Dumb first try suggestion... : ) > Write your own super-short Trans handlers that stores the pre-mapped value > in pnotes. I actually found an initial answer after digging through the docs. After mapping the file I can create a new sub-request via lookup_file($filename) and take appropriate action. So far so good . . .
RE: Mapping files
Dumb first try suggestion... Write your own super-short Trans handlers that stores the pre-mapped value in pnotes. -Original Message- From: Stathy G. Touloumis [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 13, 2002 6:53 PM To: mod_perl List Subject: Mapping files Hi, I am trying to map a uri to a file based on certain factors. I would like to have this done after the 'Trans' phase when certain information is available. I noticed when the original file mapping does not exist (what apache maps in it's 'Trans' phase) the 'content_type' method does not return a value. Also, even after remapping the file and changing the status a 'file not found' error is printed in the error logs. Any pointers as to what I might be doing wrong? Thanks, -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
If mod_perl module loaded from within httpd.conf
What is the best way to check from within the httpd.conf file if a mod_perl module is loaded. For C modules, I can use: ... to conditionally load it's directives. Is there a similar conditional syntax for the mod_perl script modules? I only want a module's directives to be processed when that module is loaded. ++ | George Sanderson <[EMAIL PROTECTED]> | http://www.xorgate.com ++
RE: loss of shared memory in parent httpd
It's copy-on-write. The swap is a write-to-disk. There's no such thing as sharing memory between one process on disk(/swap) and another in memory. You'll also want to look into tuning your paging algorithm. This will hold swapping at bay longer. The paging algorithm USED to be configurable with a bunch of kernal params (params.(h|c)) stuff like PAGEHANDSFREE but I really don't know anymore. HTH, -Josh -Original Message- From: Ask Bjoern Hansen [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 12, 2002 7:17 PM To: Graham TerMarsch Cc: Bill Marrs; [EMAIL PROTECTED] Subject: Re: loss of shared memory in parent httpd On Tue, 12 Mar 2002, Graham TerMarsch wrote: [...] > We saw something similar here, running on Linux servers. Turned out to be > that if the server swapped hard enough to swap an HTTPd out, then you > basically lost all the shared memory that you had. I can't explain all of > the technical details and the kernel-ness of it all, but from watching our > own servers here this is what we saw on some machines that experienced > quite a high load. > > Our quick solution was first to reduce some the number of Mod_perls that > we had running, using the proxy-front-end/modperl-back-end technique, You should always do that. :-) > and then supplemented that by adding another Gig of RAM to the > machine. > > And yes, once you've "lost" the shared memory, there isn't a way to get it > back as "shared" again. And yes, I've also seen that when this happens > that it could full well take the whole server right down the toilet with > it (as then your ~800MB of shared memory becomes ~800MB of _physical_ > memory needed, and that could throw the box into swap city). I forwarded this mail to one of the CitySearch sysadmins who had told about seeing this. He is seeing the same thing (using kernel 2.4.17), except that if he disables swap then the processes will get back to reporting more shared memory. So maybe it's really just GTop or the kernel reporting swapped stuff in an odd way. No, I can't explain the nitty gritty either. :-) Someone should write up a summary of this thread and ask in a technical linux place, or maybe ask Dean Gaudet. - ask -- ask bjoern hansen, http://ask.netcetera.dk/ !try; do(); -- This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice.
Mapping files
Hi, I am trying to map a uri to a file based on certain factors. I would like to have this done after the 'Trans' phase when certain information is available. I noticed when the original file mapping does not exist (what apache maps in it's 'Trans' phase) the 'content_type' method does not return a value. Also, even after remapping the file and changing the status a 'file not found' error is printed in the error logs. Any pointers as to what I might be doing wrong? Thanks,
open3 and mod_perl
Hello folks, I am writing a web interface for the GPGP module that would allow users to create a new public and private key and adds them to the corporate key ring. I will be useing IPC::Open3 and IO::Select to "control" stdin and stdout of GPGP. Are there any issues that I should be aware w/ these packages under mod_perl? Any suggestions and comments would be greatly welcomed. Thanks in advance -r
Re: query
Hi there, On Wed, 13 Mar 2002, Parag R Naik wrote: > We have installed perl 5.6 Make sure you get 5.6.1 not 5.6.0 which is buggy. 73, Ged.
Re: File upload example
On Wed, 13 Mar 2002, John Saylor wrote: > Hi > > > On Tue, 12 Mar 2002, John Saylor wrote: > > > I have found that some browsers put the file in the value matching > > > the parameter name instead of putting a file upload object there. > > ( 02.03.12 18:36 -0500 ) Rich Bowen: > > That's not really necessary, as Apache::Request does that for you. > > Maybe I was using an earlier version, but Apache::Request was NOT doing > it for me, so that is why I needed to do this extra stuff. OK. Nasty. I will check into this more carefully. -- Rich Bowen http://www.apacheadmin.com/ Apache Support and Training
Problems migrating from Apache::OutputChain to Apache::Filter
I've been using Apache::OutputChain for stacking output handlers, and recently needed the caching feature of Apache::Filter, so I've been switching my modules over to using it instead. The system is a little convuluted. Each URI on the site depends on 3 files, a .html file which contains content, a local navigation configuration file, and a template. Using Apache::OutputChain I had a hacked up version of Apache::SendFile to determine the meets_conditions() method of the request object. The modified version of Apache::SendFile seems to be working fine. I tested it using this httpd.conf PerlHandler setup: PerlModule Apache::Filter DocumentRoot /home/httpd/html ServerName sunset.localdomain ErrorLog logs/sunset_errors CustomLog logs/sunset_access combined SetHandler perl-script PerlSetVar Filter On PerlHandler Apache::SendFile #PerlHandler Apache::SendFile Apache::NavGraphics #PerlHandler Apache::NavGraphics PerlSetVar MyTemplate etc/Sunset6.template PerlSetVar NavGraphicsDir /navgraphics Using this module as a filter, I was able to get content from the server with no problems. Next, the file went to a hacked up version of Lincoln Stein's Apache::NavBar program, except it now does dynamic graphic creation for navigation and templating (that's where the caching comes in). However, after modifying it to use Apache::Filter it appears to create an infinite loop inside the server. Here's a snippet of the access log: 192.168.0.7 - - [03/Mar/2002:01:12:55 -0800] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901" 192.168.0.7 - - [03/Mar/2002:01:12:55 -0800] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901" 192.168.0.7 - - [03/Mar/2002:01:12:55 -0800] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901" 192.168.0.7 - - [03/Mar/2002:01:12:55 -0800] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901" 192.168.0.7 - - [03/Mar/2002:01:12:55 -0800] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901" 192.168.0.7 - - [03/Mar/2002:01:12:55 -0800] "GET / HTTP/1.1" 200 - "-" "Mozilla/5.0 (X11; U; Linux i586; en-US; rv:0.9.2.1) Gecko/20010901" The server will continue to generate these requests as long as the browser waits, thousands of them off of a single page request. I've tried testing this module standalone, and chained with SendFile and the behavior is the same. I eventually winnowed the module down to a handful of lines. sub handler { my $r = shift; $r = $r->filter_register(); my $fh = $r->filter_input(); while (<$fh>) { print; warn ">$_<"; } } The warn shows that the filehandle seems to be empty but infinite in size since the error_log is full of this: >< >< >< >< >< >< >< >< I've attached both modules to this email. I've tried general Google searches and Google searches through the mod_perl archives and haven't found anyone else with this or a similar problem. RH mod_perlapache perlApache::Filter 7.2 1.24_01 1.3.20-16 5.6.0-171.019 Colin package Apache::SendFile; use strict; use Apache::Constants qw(:response :methods :http); use Apache::File; use Apache::Log; use Apache::Filter; use Apache::URI; use File::Basename; use vars qw( $VERSION ); $VERSION = '0.03'; sub handler { my $r = shift; $r=$r->filter_register(); $r->content_type eq 'text/html' || return DECLINED; #warn time(), "\n"; if ((my $rc = $r->discard_request_body) != OK) { return $rc; } if ($r->method_number == M_INVALID) { $r->log->error("Invalid method in request ", $r->the_request); return NOT_IMPLEMENTED; } if ($r->method_number == M_OPTIONS) { return DECLINED; #http_core.c:default_handler() will pick this up } if ($r->method_number == M_PUT) { return HTTP_METHOD_NOT_ALLOWED; } unless (-e $r->finfo) { $r->log->error("File does not exist: ", $r->filename); return NOT_FOUND; } if ($r->method_number != M_GET) { return HTTP_METHOD_NOT_ALLOWED; } my $fh = Apache::File->new($r->filename); unless ($fh) { $r->log->error("file permissions deny server access: ", $r->filename); return FORBIDDEN; } ##Let Apache check the file modification times for ##the source file, navigation config file and the ##templates. my $navConf = join '/', $r->document_root(), dirname($r->parsed_uri()->path), 'navConf.txt'; my $template = $r->server_root_relative($r->dir_config('MyTemplate')); $r->update_mtime(); foreach ($navConf, $template) { next unless -e $_; $r->update_mtime((stat _)[9]); } $r->set
Re: File upload example
Hi > On Tue, 12 Mar 2002, John Saylor wrote: > > I have found that some browsers put the file in the value matching > > the parameter name instead of putting a file upload object there. ( 02.03.12 18:36 -0500 ) Rich Bowen: > That's not really necessary, as Apache::Request does that for you. Maybe I was using an earlier version, but Apache::Request was NOT doing it for me, so that is why I needed to do this extra stuff. -- \js "embrace impactful experiences"
[JOB] mod_perl programmer
Hi all, due to a recent series of events, I find myself looking for a job. I'm open to all sorts of jobs: contracts, telecommute, or full-time. I'm presently living in Paris and would prefer to stay, but don't hesitate to offer jobs in other places as I'm not afraid of moving and could very well change my mind about staying here if faced with an interesting offer. You can find my résumé at the following places: english: http://robin.berjon.com/english.html french: http://robin.berjon.com/ Thanks for your attention, happy modperling all! -- ___ Robin Berjon <[EMAIL PROTECTED]> -- CTO k n o w s c a p e : // venture knowledge agency www.knowscape.com --- Change is inevitable except from a vending machine.
RE: Apache->print Timeout
Yeah that's what the Eagle book says. I was surprised initially because our timeout's are set to 10min. and the process seemed to end prematurely (before 10min). Thanks, > > Do you know if this setting taken from the Apache conf > directive 'Timeout'? > > $r->server->timeout directly gets/sets the value for the httpd.conf > Timeout directive for the server in question - see Chapter 4 in the > cookbook ;) > > I don't have a copy of the Eagle book in front of me, and we don't > talk about these methods explicitly, but IIRC they manipulate Apache's > internal timeouts, which are based on the Timeout setting.
Re: Apache->print Timeout
Geoffrey Young wrote: > I don't have a copy of the Eagle book in front of me The API chapter is online and it talks about print() and timeouts: http://modperl.com:9000/book/chapters/ch9.html - Perrin
Re: Serious bug, mixing mod-perl content
Could you describe the actual nature of the error? How can you tell that the response you're getting is from the wrong virtual host and what is different about the virtual hosts' setup that causes the difference in responses? - Perrin
Re: Apache->print Timeout
"Stathy G. Touloumis" wrote: > > Thanks for the response, > > Do you know if this setting taken from the Apache conf directive 'Timeout'? $r->server->timeout directly gets/sets the value for the httpd.conf Timeout directive for the server in question - see Chapter 4 in the cookbook ;) I don't have a copy of the Eagle book in front of me, and we don't talk about these methods explicitly, but IIRC they manipulate Apache's internal timeouts, which are based on the Timeout setting. --Geoff
RE: Apache->print Timeout
Thanks for the response, Do you know if this setting taken from the Apache conf directive 'Timeout'? Thanks , > -Original Message- > From: Geoffrey Young [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, March 13, 2002 10:41 AM > To: Stathy G. Touloumis > Cc: [EMAIL PROTECTED] > Subject: Re: Apache->print Timeout > > > "Stathy G. Touloumis" wrote: > > > > Does anyone know how to set the time out value for > Apache::print to a higher > > value if possible or how to avoid a timeout?? I am performing an import > > into a database that can vary in time (1min - 10min) and I > would need to be > > able to handle this situation. Would it be better to spawn a > subprocess and > > have the client refresh to monitor the result (like > Apache::UploadMeter)? > > > > [Wed Mar 13 10:28:41 2002] [info] [client 192.168.6.22] mod_perl: > > Apache->print timed out > > look at $r->reset_timeout and kin in the eagle book. you can also set > the value of Timeout for the server dynamically using > $r->server->timeout. > > HTH > > --Geoff >
Re: Apache->print Timeout
"Stathy G. Touloumis" wrote: > > Does anyone know how to set the time out value for Apache::print to a higher > value if possible or how to avoid a timeout?? I am performing an import > into a database that can vary in time (1min - 10min) and I would need to be > able to handle this situation. Would it be better to spawn a subprocess and > have the client refresh to monitor the result (like Apache::UploadMeter)? > > [Wed Mar 13 10:28:41 2002] [info] [client 192.168.6.22] mod_perl: > Apache->print timed out look at $r->reset_timeout and kin in the eagle book. you can also set the value of Timeout for the server dynamically using $r->server->timeout. HTH --Geoff
Apache->print Timeout
Does anyone know how to set the time out value for Apache::print to a higher value if possible or how to avoid a timeout?? I am performing an import into a database that can vary in time (1min - 10min) and I would need to be able to handle this situation. Would it be better to spawn a subprocess and have the client refresh to monitor the result (like Apache::UploadMeter)? [Wed Mar 13 10:28:41 2002] [info] [client 192.168.6.22] mod_perl: Apache->print timed out
Re: performance testing - emulating real world use
Jauder Ho wrote: > Another application (commercial) is Mercury Interactive's LoadRunner. My experience with commercial load-testing apps is that they are outrageously expensive, a pain to program, don't really scale all that well, and mostly have to run on Windows with someone sitting at the mouse. There are some that work better than others, but the free stuff in this areas is quite good. I recommend httperf and http_load for banging on lists of URLs really hard. At eToys, one of our developers rigged up some shell scripts that would play back log files through httperf and that worked pretty well. If you want to record browser sessions for testing specific paths through the site, look at http://sourceforge.net/projects/http-recorder/ or http://sourceforge.net/projects/roboweb/. There's also webchatpp, HTTP::WebTest, and HTTP::MonkeyWrench on CPAN. All of these have been discussed on this list before. - Perrin
Re: Memory query
Andrew Green wrote: > In particular, I'm > looking for reassurance that passing a reference to a hash doesn't copy > the hash itself into memory in any way, and that the memory overhead is > only as large as the largest $item. That's basically correct, but some dbm implementations will use their own caching and that may increase this overhead. > Similarly, if I was to > > use vars(%hash); > > and initialise the tied hash as a global, does this have a significant > memory overhead? No, it's the same except for the addition of an entry in the symbol table. > Does untie-ing the hash clear the hash contents from > memory, or do I also need to undef the hash to avoid the hash contents > persisting from one request to the next? If you actually want to free the memory, you need to undef it. The untie prevents it from persisting, but the memory stays allocated unless you undef. > Is one approach better than the > other? Not in terms of memory. The thing you need to think about with regard to dbm files is how to make sure they are synchronized between multiple processes. You basically just need to untie them after each request (unless it's read-only data). By the way, MLDBM::Sync takes care of all of that for you. - Perrin
Re: Blank Pages ( Revisited ) [Semi-OT]
> > However, when I do a "random" query I get some blank pages. I traced this to > > the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". I found that sometimes > > the "execute()" returns "0E0". Does anybody knows why?? > > It probably means zero multiplied by ten to the power zero, or to put > it another way, zero. Perl has three values that are false: 0, "" and undef. Anything else is true. OE0 is the "0 but true" value that DBI uses to signal that zero rows were returned, but succeeded. xoxo, Andy -- 'Andy Lester[EMAIL PROTECTED] Programmer/author petdance.com Daddy parsley.org/quinn Jk'=~/.+/s;print((split//,$&) [unpack'C*',"n2]3%+>\"34.'%&.'^%4+!o.'"])
Re: query
Parag R Naik wrote: > We have installed perl 5.6 but we are > not able to figure out how to instruct apache to use that version of > perl(5.6 You have to re-compile mod_perl. > Is the "our" directive used in some of files new to perl 5.6 because we > could not find that directive in the most of the perl books we referered > to. Yes, it is new in 5.6. The most recent version of the camel book describes it, and so do the man pages. - Perrin
query
The we are not able to bring the site up and running on linux version 6.2 with perl 5.005 , mod_perl 1.21 , I think the problem is the version of the perl that we are using . We have installed perl 5.6 but we are not able to figure out how to instruct apache to use that version of perl(5.6) .Are there any configuration parameter that could be changed . Is the "our" directive used in some of files new to perl 5.6 because we could not find that directive in the most of the perl books we referered to.
Re: loss of shared memory in parent httpd
I just wanted to mention that the theory that my loss of shared memory in the parent is related to swapping seems to be correct. When the lack of sharing occurs, it is correlated with my httpd processes showing a SWAP (from top/ps) of 7.5MB, which is roughly equal to the amount of sharing that I lose. I've been lowering my MaxClients setting (from 25 to 10, so far) in hopes of finding a new balance where SWAP is not used, and more RAM is on order. Thanks -bill
Re: Serious bug, mixing mod-perl content
> Miroslav Madzarevic wrote: > > Ernest: I don't use server aliases but I'm going to fix that. I wish > that the problem is so simple. Actually the two virt. hosts are > beta.domain.com and www.domain.com > So the httpd.conf should read: ServerName www.domain.com ServerAlias *.domain.com ServerAlias domain.com # ... ServerName beta.domain.com # no alias! # ... So every request except for beta.domain.com will go to the first VH: The order of the VirtualHost-entries in httpd.conf are important - see http://httpd.apache.org/docs/vhosts/details.html Ernest -- * * VIRTUALITAS Inc. * * ** * * European Consultant Office * http://www.virtualitas.net * * Internationales Handelszentrum * contact:Ernest Lergon * * Friedrichstraße 95 *mailto:[EMAIL PROTECTED] * * 10117 Berlin / Germany * ums:+49180528132130266 * *
ANNOUNCE: Embperl 2.0b6
The URL ftp://ftp.dev.ecos.de/pub/perl/embperl/Embperl-2.0b6.tar.gz has entered CPAN as file: $CPAN/authors/id/G/GR/GRICHTER/Embperl-2.0b6.tar.gz size: 623200 bytes md5: 966e109d700fb76e6df18316c1cf16a1 Embperl is a system for building dynamic websites with Perl. See http://perl.apache.org/embperl/ (english) or http://www.ecos.de/embperl/ (german) for more information. I am very happy to announce the 6th beta of Embperl 2.0. It contains a lot of important improvements since the last beta release: - Reworked the internal object structure and make it available to Perl - Introduction of the application object and support for it in Embperl::Object, which eases the proper seaparation of Code and Layout - Support for internationalization - Module for form validation (client- and server-side) - Moved Embperl from HTML::Embperl to Embperl namespace since it no longer only serves HTML. This also allows to use 1.3 and 2.0 within the same server. - Support for Apache native configuration directives. No need to use enviroment variables for configuration anymore (but still possible) - Cleanup of a lot of legency code and move of most of the Perl parts into C, which makes execution of small files 30%-50% faster - Better support for XML, Recipes, Providers, Caches etc. IMPORTANT: The documentation is not up to date yet, all new features are documented in README.v2, so make sure you read that file first. This release contains all features that I have planed for 2.0. So I will now focus and bugfixing and documentation. Please give this beta a try and give me feedback, so we soon can make a final 2.0 release. Enjoy Gerald All Changes since 2.0b5: - Embperl have move from the namespace HTML::Embperl to Embperl. This is because Embperl is no longer only a HTML framework, but is suitable for other formats like XML too. Also this allows to install Embperl 1.x and 2.x on the same machine without conflicts, to make a smooth upgrade. - Rewrote Embperl internal data structures. The Embperl request structure is now splitted into thread, application, request and component structure. - Moved nearly all of the per request/component initialization code from Perl to C. Together with the optimized data structures, this speeds up request/component initialization, which is especialy a performance improvement for pages that do a lot calls to Execute (up to 50% for small includes). - All members of these structures now available form Perl which avoids using mod_perl Apache object and enviroment variables in most cases, makeing the resulting pages more independend from the environment they run under. On the other side this gives quite a few new possibilities to influence what Embperl is doing, especialy together with Embperl::Object. - Introduced new application object which holds together a set of pages and allows to configure the Embperl logfile and session handling different for each application. - Added Embperl::Object application object, which is invoked during request initialization. Any application code can now go there. This allows a proper separation of Code and Design and building of MVC (Model, Controller, View), 2-Tier and 3-Tier applications with Embperl. - Added EMBPERL_APP_HANDLER_CLASS to set the application object for Embperl pages, when not using Embperl::Object - Embperl now uses nativ Apache configuration directives instead of enviroment variables when running under mod_perl. You need to load Embperl before you can use any of them, either via "PerlModule Embperl" or via "use Embperl" inside of a startup script. "Embperl_UseEnv on" is provided to get the old behaviour of using environment variables for configuration. - The default for input unescaping is now set to off. So people which are working with an text editor should be happy, people who are using any sort of HTML editor should use EMBPERL_INPUT_ESCMODE to set the way Embperl interprets the input. - Added new configuration directives EMBPERL_INPUT_ESCMODE which controls the unescaping of the input. This superseds the old optRawInput and allows a more differentiated control. - Added form data validation. Embperl is now capable to do server-side and client-side validation of form input. You just have to define a set of rules and Embperl generates the correct JavaScript code and does the validation when the form data is posted to the server. By writing or overriding class, the validatior could be extented. See Embperl::Form::Validate for details. - Added [= foo =] block and $r -> gettext method for page localization. When the page is executed the 'foo' is replaced with a localizied message for the current language. - Added methods r -> messages and r -> default_messages to define current message set for current
Re: Blank Pages ( Revisited ) [Semi-OT]
On Wed, 13 Mar 2002 10:29:51 + (GMT), Ged Haywood wrote: >Hi there, > >On Wed, 13 Mar 2002 [EMAIL PROTECTED] wrote: > >>However, when I do a "random" query I get some blank pages. I >>traced this to >>the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". I found that >>sometimes >>the "execute()" returns "0E0". Does anybody knows why?? It's DBI's way of saying 0 (records returned) but true. Ie It's deliberate. -- Ron Savage, [EMAIL PROTECTED] on 13/3/02 http://savage.net.au/index.html
Memory query
Morning all, Forgive the naivete, but I'm having trouble wrapping my mind around the memory implications of using tied hashes, and I haven't found anything in the Camel book or the Guide to clarify the situation for me. A fair amount of my Registry scripts need to use code not unlike the following: use strict; use Fcntl; use MLDBM qw(DB_File Storable); [...] tie(my %hash, 'MLDBM', $filename, O_RDONLY, 0644) or die "Denied $filename: $!\n"; foreach my $item (keys %hash) { action(\%hash,$item); } untie %hash; I'm intrigued about the memory implications of this kind of construction where the MLDBM hash is potentially very large. In particular, I'm looking for reassurance that passing a reference to a hash doesn't copy the hash itself into memory in any way, and that the memory overhead is only as large as the largest $item. Similarly, if I was to use vars(%hash); and initialise the tied hash as a global, does this have a significant memory overhead? Does untie-ing the hash clear the hash contents from memory, or do I also need to undef the hash to avoid the hash contents persisting from one request to the next? Is one approach better than the other? As I said, my apologies for the newbieness of all this, and even bigger apologies if it represents an FAQ that I've missed spotting. Many thanks, Andrew. -- perl -MLWP::Simple -e 'getprint("http://www.article7.co.uk/res/japh.txt";);'
RE: Tie hashes in DBIx::Recordset [OT]
Obviously sorting the hash keys wont give you the columns in the select statement order. After doing something like: my $sth = $dbh->execute(@params) or die... You can get back the lower case column names in the select statement order using: my @names = @{$sth->{NAME_lc}}; Note that $sth->{NAME_lc} is not always populated, depending upon your SQL. Regards Jeff -Original Message- From: Ged Haywood [mailto:[EMAIL PROTECTED]] Sent: 13 March 2002 10:30 To: Marcus Claesson Cc: [EMAIL PROTECTED] Subject: Re: Tie hashes in DBIx::Recordset [OT] Hi there, On Wed, 13 Mar 2002, Marcus Claesson wrote: > How do I succesfully preserve the column order (''$fields'=> > $joined_col') in my array-of-hashes generated using DBIx::Recordset? Check out a Perl tutorial or the Camel book. Perl's hashes do their own thing with ordering, so unless you do something like (sort keys %hash) you will get what you get. Arrays can preserve sequences but involve you in more coding much of the time. 73, Ged.
Re: Tie hashes in DBIx::Recordset [OT]
>Perl's hashes do their own thing with ordering, so unless you do something like (sort keys %hash) >you will get what you get. Yes, but tieing the hash while creating it, in my case with Tie::IxHash, should preserve the inesertion order. That works with for example tie %hash, 'Tie::IxHash'; %hash = ("one"=>"1", "two"=>"2", "three"=>"3"); But not when I create an array of hashes using DBIx::Recordset like below: use Tie::IxHash; use DBIx::Recordset; ...sub execute { tie %main::set, 'Tie::IxHash'; *main::set = DBIx::Recordset->Search({('!DataSource' => $db, '!Table' => $table, '$fields' => $joined_col, '$where'=> $query, '$max' => 10)}); } Marcus Ged Haywood wrote: > Hi there, > > On Wed, 13 Mar 2002, Marcus Claesson wrote: > > > How do I succesfully preserve the column order (''$fields'=> > > $joined_col') in my array-of-hashes generated using DBIx::Recordset? > > Check out a Perl tutorial or the Camel book. Perl's hashes do their own > thing with ordering, so unless you do something like (sort keys %hash) > you will get what you get. Arrays can preserve sequences but involve > you in more coding much of the time. > > 73, > Ged.
Re: Serious bug, mixing mod-perl content
Stas: I have 1.24 ver. of mod-perl and as I see current Apache Registry sets $Apache::Registry::NameWithVirtualHost explicitly to 1 if it's not defined (I've seen the sources). These are apache's startup messages: [Fri Mar 1 11:47:28 2002] [notice] Apache-AdvancedExtranetServer/1.3.14 (Linux-Mandrake/2mdk) mod_perl/1.24 configured -- resuming normal operations[Fri Mar 1 11:47:28 2002] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) Ernest: I don't use server aliases but I'm going to fix that. I wish that the problem is so simple. Actually the two virt. hosts are beta.domain.com and www.domain.com Christian: The setup is consisting of two httpd's, one without mod-perl and one with mod-perl. First apache serves as a proxy to a second one using mod-proxy and mod-rewrite. The second one is mod-perl enabled and hosts Apache::Registry scripts. First one hosts plain cgi-scripts.On both apaches there are two virt hosts, first apache one contains world viewable virt. hosts and the second one contains internal virt hosts (accessible only from 127.0.0.1, from first apache). The names and paths are different but the error occurs, although it's very rare. I'm not using HTML::Mason here. I noticed the error when I got error messages from beta which contains new code and I was actually working with www. tnx. for suggestions -Best regards, Miroslav Madzarevic, Senior Perl Programmer[EMAIL PROTECTED]Mod Perl Development http://www.modperldev.comTelephone: +381 64 1193 501jamph $_=",,.,,.,,,.,,,.,,,..,,.,,,.,.,,,";s/\s//gs;tr/,./05/;my(@a,$o,$i)=split//;$_=;tr/~`'"^/0-4/;map{$o.=$a[$i]+$_;$i++}split//;@a=$o=~m!...!g;map{print chr}@a; __DATA__`~^`~~``^`~`~`^``~`~``''~^'`~^``'``^```~^``'```'~`~
Re: Blank Pages ( Revisited ) [Semi-OT]
Hi there, On Wed, 13 Mar 2002 [EMAIL PROTECTED] wrote: > However, when I do a "random" query I get some blank pages. I traced this to > the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". I found that sometimes > the "execute()" returns "0E0". Does anybody knows why?? It probably means zero multiplied by ten to the power zero, or to put it another way, zero. 73, Ged.
Re: Tie hashes in DBIx::Recordset [OT]
Hi there, On Wed, 13 Mar 2002, Marcus Claesson wrote: > How do I succesfully preserve the column order (''$fields'=> > $joined_col') in my array-of-hashes generated using DBIx::Recordset? Check out a Perl tutorial or the Camel book. Perl's hashes do their own thing with ordering, so unless you do something like (sort keys %hash) you will get what you get. Arrays can preserve sequences but involve you in more coding much of the time. 73, Ged.
Re: Cookies and redirects
On Tue, 12 Mar 2002 16:23:57 +0100 Axel Andersson <[EMAIL PROTECTED]> wrote: > Hello, > I'm having trouble with both setting a cookie and redirecting the user to > another page at the same time. It would appear the cookie is only sent > when a normal header is sent by server. > > If I do the following (having baked the cookie first), where $r is the > Apache->request() object: > > $r->content_type("text/html; charset=iso-8859-1"); > $r->send_http_header(); > Hi, a common trick to solve this is to use err_header_out() request method. For example: use Apache::Constants qw(:common); $r->err_header_out("Set-Cookie" => $my_cookie ); $r->custom_response(SERVER_ERROR, $my_custom_redir_location); return SERVER_ERROR; Bye Enrico = Enrico Sorcinelli - Gruppo E-Comm - Italia On Line S.p.a. E-Mail: [EMAIL PROTECTED] - [EMAIL PROTECTED] =
Tie hashes in DBIx::Recordset
Hi, How do I succesfully preserve the column order (''$fields'=> $joined_col') in my array-of-hashes generated using DBIx::Recordset? When I run the code below, the column order doesn't differ at all from when I don't tie the %main::set hash. /Marcus ___ use Tie::IxHash; use DBIx::Recordset; sub execute { tie %main::set, 'Tie::IxHash'; *main::set = DBIx::Recordset->Search({('!DataSource' => $db, '!Table' => $table, '$fields' => $joined_col, '$where'=> $query, '$max' => 10)}); }