Re: Apache::GTopLimit
Stas: Since you wrote the script, do you recommend some good default settings in GTopLimit to start with, i.e., use Apache::GTopLimit; Apache::GTopLimit-set_max_size(1); Apache::GTopLimit-set_min_shared_size(4000); Apache::GTopLimit-set_max_unshared_size(6000); $Apache::GTopLimit::CHECK_EVERY_N_REQUESTS = 2; I would like to start with recommended defaults and tweak if necessary from there. Thanks. Gregory At 01:33 AM 5/22/2002 +0800, you wrote: Perrin Harkins wrote: Stas Bekman wrote: Hmm, when a new process starts it shares *everything* with the parent. Why do you say that it's not? It doesn't share everything with the parent. As soon as it forks there is unshared memory, and after the first request it handles there is usually more. Over time, the average amount of shared memory among child processes seems to gradually decrease. Restarting fixes this. What you are saying is that when the server is started afresh, the newly started child processes share more memory with the parent, than newly started child processes some time later. Am I correct? __ 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
GTop
I am trying to install GTop in order to install GTopLimit and am getting the following error on make: glob failed (child exited with status 2) at Makefile.PL line 242. glob failed (child exited with status 2) at Makefile.PL line 242. Note (probably harmless): No library found for -lgtop Note (probably harmless): No library found for -lgtop_sysdeps Note (probably harmless): No library found for -lgtop_common Note (probably harmless): No library found for -lglib Can't exec glib-config: No such file or directory at (eval 18) line 12. Note (probably harmless): No library found for -lgtop Note (probably harmless): No library found for -lgtop_sysdeps Note (probably harmless): No library found for -lgtop_common Note (probably harmless): No library found for -lglib Writing Makefile for GTop::Server Writing Makefile for GTop make Skip blib/lib/GTop.pod (unchanged) Skip blib/lib/GTop.pm (unchanged) /usr/bin/perl -I/usr/libdata/perl/5.00503/mach -I/usr/libdata/perl/5.00503 /usr/libdata/perl/5.00503/ExtUtils/xsubpp -typemap /usr/libdata/perl/5.00503/ExtUtils/typemap -typemap typemap.gtop -typemap typemap -typemap typemap GTop.xs xstmp.c mv xstmp.c GTop.c cc -c-DVERSION=\0.10\ -DXS_VERSION=\0.10\ -DPIC -fpic -I/usr/libdata/perl/5.00503/mach/CORE GTop.c GTop.xs:5: glib.h: No such file or directory GTop.xs:6: glibtop.h: No such file or directory GTop.xs:7: glibtop/open.h: No such file or directory GTop.xs:8: glibtop/close.h: No such file or directory GTop.xs:9: glibtop/xmalloc.h: No such file or directory GTop.xs:10: glibtop/parameter.h: No such file or directory GTop.xs:11: glibtop/union.h: No such file or directory GTop.xs:12: glibtop/sysdeps.h: No such file or directory *** Error code 1 I am on a Unix machine running FreeBSD. Any ideas? I saw that Stas had a similar problem a couple of year ago or so when trying to install the same thing. Gregory
GTop
When trying to install GTop, I received the following Note (probably harmless): No library found for -lgtop Note (probably harmless): No library found for -lgtop_sysdeps Note (probably harmless): No library found for -lgtop_common Note (probably harmless): No library found for -lglib Can't exec glib-config: No such file or directory at (eval 18) line 12. Note (probably harmless): No library found for -lgtop Note (probably harmless): No library found for -lgtop_sysdeps Note (probably harmless): No library found for -lgtop_common Note (probably harmless): No library found for -lglib Writing Makefile for GTop::Server Writing Makefile for GTop My glib-config directory is /usr/local/bin and the name of the actual file is glib12-config. How can I tell GTop where this file is and what the actual file name is? Don't ask me why my server named it that way, but when doing ### a %locate glib command, I get (you'll see the glib12-config file down towards the bottom): /compat/linux/usr/bin/glibcbug /compat/linux/usr/doc/glib-1.2.6 /compat/linux/usr/doc/glib-1.2.6/AUTHORS /compat/linux/usr/doc/glib-1.2.6/COPYING /compat/linux/usr/doc/glib-1.2.6/ChangeLog /compat/linux/usr/doc/glib-1.2.6/NEWS /compat/linux/usr/doc/glib-1.2.6/README /compat/linux/usr/doc/glibc-2.1.2 /compat/linux/usr/doc/glibc-2.1.2/BUGS /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.1.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.2.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.3.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.4.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.5.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.6.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.7.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.8.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.9.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.gz /compat/linux/usr/doc/glibc-2.1.2/ChangeLog.threads.gz /compat/linux/usr/doc/glibc-2.1.2/Changes.threads /compat/linux/usr/doc/glibc-2.1.2/FAQ /compat/linux/usr/doc/glibc-2.1.2/FAQ-threads.html /compat/linux/usr/doc/glibc-2.1.2/INSTALL /compat/linux/usr/doc/glibc-2.1.2/NEWS /compat/linux/usr/doc/glibc-2.1.2/NOTES /compat/linux/usr/doc/glibc-2.1.2/PROJECTS /compat/linux/usr/doc/glibc-2.1.2/README /compat/linux/usr/doc/glibc-2.1.2/README.crypt /compat/linux/usr/doc/glibc-2.1.2/README.db2 /compat/linux/usr/doc/glibc-2.1.2/README.db2.mutex /compat/linux/usr/doc/glibc-2.1.2/README.hesiod /compat/linux/usr/doc/glibc-2.1.2/README.libm /compat/linux/usr/doc/glibc-2.1.2/README.template /compat/linux/usr/doc/glibc-2.1.2/README.threads /compat/linux/usr/doc/glibc-2.1.2/README.timezone /compat/linux/usr/doc/glibc-2.1.2/README.utmpd /compat/linux/usr/doc/glibc-2.1.2/examples.threads /compat/linux/usr/doc/glibc-2.1.2/examples.threads/Makefile /compat/linux/usr/doc/glibc-2.1.2/examples.threads/ex1.c /compat/linux/usr/doc/glibc-2.1.2/examples.threads/ex2.c /compat/linux/usr/doc/glibc-2.1.2/examples.threads/ex3.c /compat/linux/usr/doc/glibc-2.1.2/examples.threads/ex4.c /compat/linux/usr/doc/glibc-2.1.2/examples.threads/ex5.c /compat/linux/usr/doc/glibc-2.1.2/examples.threads/ex6.c /compat/linux/usr/lib/libglib-1.2.so.0 /compat/linux/usr/lib/libglib-1.2.so.0.0.6 /usr/local/bin/glib12-config /usr/local/include/glib12 /usr/local/include/glib12/glib.h /usr/local/include/glib12/glibconfig.h /usr/local/include/glib12/gmodule.h /usr/local/include/jpeglib.h /usr/local/info/glib.info /usr/local/lib/libglib12.a /usr/local/lib/libglib12.so /usr/local/lib/libglib12.so.3 /usr/local/man/man1/glib12-config.1.gz /usr/local/share/aclocal/glib.m4 /var/db/pkg/glib-1.2.8 /var/db/pkg/glib-1.2.8/+COMMENT /var/db/pkg/glib-1.2.8/+CONTENTS /var/db/pkg/glib-1.2.8/+DESC /var/db/pkg/glib-1.2.8/+REQUIRED_BY
Re: GTop
Thanks Perrin. I've wasted so much time today trying to figure out what was going on with my glib installation. I guess your suggestion might be the better solution anyhow as I sure don't want to run into installation problems for my customers down the road! I also suppose that this means that I will be unable to use the VMonitor module. Back to top! Thanks again. Gregory At 10:00 PM 5/21/2002 -0400, you wrote: If you're not able to resolve your difficulties with GTop, try Apache::SizeLimit instead. It fully supports FreeBSD. You just need to install the BSD::Resource module, which is useful to have anyway. - Perrin
Perl written in mod_perl
Here's an odd question for you. Why is it when I go to places like cgi-resources.com and other cgi repositories, mod_perl applications are far and few between...commercially that is? All I see are common cgi scripts written in plain perl. Does it have anything to do with the configurability tasks involved on the customers box, i.e., once the sale is made? If this is the wrong place for a question like this, I apologize. Just curious. Gregory
Re: Memory Leaks
I too thought of setting a cron job to restart the server once per day in order to keep the memory fresh. In a production environment, are there any downsides to doing this, i.e., server inaccessibility, etc..? Thanks. Gregory At 08:25 AM 5/20/2002 -0400, you wrote: It is more an issue of it being worth tracking down a small memory leak vs a large memory leak. Our software still has some very small leaks, on the order of 10kv every hour... it would probably take us a month to track down and solve all these problems. I find it easier to restart the web servers daily. We did have some enourmous leaks as well, based on circular reference, and those ate up 1 GB of memory in about 30 minutes... It took us about three weeks to find it. Gregory Matthews writes: So am I being overly paranoid concerning the leak potential of mod_perl programming? If I start with strict code to begin with and try my best to stay away from the problems you mentioned, then any potential memory leak/drain issues will be avoided? Keep in mind, although my application is not designed to launch the space shuttle, I do want it to be solid/stable/peformance-packed from the ground up. I will be also be using MySql with the Apache::DBI module. Thanks in advance. Gregory At 11:34 PM 5/19/2002 -0400, you wrote: I have a couple of questions regarding leaking memory in mod_perl: 1. What are the main culprits, in order of severity, of memory leaks, i.e.: a. global variables (NOT lexically scoped via my) b. ... c. ... 2. When writing code from scratch (a new application), what is the best way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn On, etc.. ? There are actually not very many ways you can leak memory in Perl (and thus mod_perl). Most people confuse memory growth with memory leakage. If you want to know how to avoid memory growth, look at the performance tuning stuff in the Guide, like passing references, avoiding slurping of large files, controlling the buffering of DBI result sets, etc. Leaks are caused by circular references, the string form of eval (at least it used to leak a little), nested closures (sometimes created accidentally with the Error module), and one or two obscure syntax problems. I think one of them involved code like my $x = 7 if $y;. Matt Sergeant got bitten by this in the early stages of AxKit development, and the details are in the mailing list archive. Global variables by themselves are not a source of leaks or growth. If you slurp a large file into a global, your process will grow, but the same is true for a lexical. - Perrin -- C Wayne Huling [EMAIL PROTECTED]
Monitoring the processes
Thanks to everyone for the great input on Memory Leaks. Now that I have a good starting point for tracking down the problem, when I TEST for leaks, or simply check for a continued increase in server memory usage, how do I go about monitoring the processes growth? For example, is there a command line tool to use that will allow me to see the process growth upon request reload? I know that I should run the server with httpd -X, but I don't know how to actually see the memory being used/increased/decreased when the prog is being executed. As I understand it, this is a good indication that there might be a problem. Thanks in advance. Gregory
Re: Memory Leaks
Unfortunately, we only have one machine. If we did employ the cron job as a clean-up utility once per day, wouldn't the potential impact of a site being unavailable only be for a few seconds (until Apache restarted)? Gregory At 05:12 PM 5/20/2002 -0400, you wrote: Like another suggestion, we have a cluster of machines and roll the restarts every hour. Each machine is offset but 10 minutes. Gregory Matthews writes: I too thought of setting a cron job to restart the server once per day in order to keep the memory fresh. In a production environment, are there any downsides to doing this, i.e., server inaccessibility, etc..? Thanks. Gregory At 08:25 AM 5/20/2002 -0400, you wrote: It is more an issue of it being worth tracking down a small memory leak vs a large memory leak. Our software still has some very small leaks, on the order of 10kv every hour... it would probably take us a month to track down and solve all these problems. I find it easier to restart the web servers daily. We did have some enourmous leaks as well, based on circular reference, and those ate up 1 GB of memory in about 30 minutes... It took us about three weeks to find it. Gregory Matthews writes: So am I being overly paranoid concerning the leak potential of mod_perl programming? If I start with strict code to begin with and try my best to stay away from the problems you mentioned, then any potential memory leak/drain issues will be avoided? Keep in mind, although my application is not designed to launch the space shuttle, I do want it to be solid/stable/peformance-packed from the ground up. I will be also be using MySql with the Apache::DBI module. Thanks in advance. Gregory At 11:34 PM 5/19/2002 -0400, you wrote: I have a couple of questions regarding leaking memory in mod_perl: 1. What are the main culprits, in order of severity, of memory leaks, i.e.: a. global variables (NOT lexically scoped via my) b. ... c. ... 2. When writing code from scratch (a new application), what is the best way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn On, etc.. ? There are actually not very many ways you can leak memory in Perl (and thus mod_perl). Most people confuse memory growth with memory leakage. If you want to know how to avoid memory growth, look at the performance tuning stuff in the Guide, like passing references, avoiding slurping of large files, controlling the buffering of DBI result sets, etc. Leaks are caused by circular references, the string form of eval (at least it used to leak a little), nested closures (sometimes created accidentally with the Error module), and one or two obscure syntax problems. I think one of them involved code like my $x = 7 if $y;. Matt Sergeant got bitten by this in the early stages of AxKit development, and the details are in the mailing list archive. Global variables by themselves are not a source of leaks or growth. If you slurp a large file into a global, your process will grow, but the same is true for a lexical. - Perrin -- C Wayne Huling [EMAIL PROTECTED] -- C Wayne Huling [EMAIL PROTECTED]
Apache::GTopLimit
Does using the Apache::GTopLimit module have the same net effect as restarting the server itself by simply killing off the actual processes which are growing beyond the set threshold, and thereby causing new processes to be born? If so, this sounds like a good alternative to setting a cron task or manually restarting the server each day/week. Gregory
Re: Apache::GTopLimit
So to modify my previous question, other than the loss of some shared memory over time, GTopLimit will have the same effect as restarting the server? On a side note, how are you tracking/discovering the this minimal loss over time? Gregory At 08:38 PM 5/20/2002 -0400, you wrote: Does using the Apache::GTopLimit module have the same net effect as restarting the server itself by simply killing off the actual processes which are growing beyond the set threshold, and thereby causing new processes to be born? It does kill off processes that are getting too big, and you definitely should use either GtopLimit or SizeLimit to get the most out of your server. However, it's not quite the same thing as a restart. Over time, some of the shared memory from the parent process appears to become unshared, and new processes that are spawned start out with less shared memory because of this. Restarting now and then takes care of this problem. - Perrin
Re: Monitoring the processes
Sorry for being lazy! I will read the guide all the way through...promise! Thanks though for everyone's help up to this point! Gregory At 12:04 PM 5/21/2002 +0800, you wrote: Gregory Matthews wrote: Thanks to everyone for the great input on Memory Leaks. Now that I have a good starting point for tracking down the problem, when I TEST for leaks, or simply check for a continued increase in server memory usage, how do I go about monitoring the processes growth? For example, is there a command line tool to use that will allow me to see the process growth upon request reload? I know that I should run the server with httpd -X, but I don't know how to actually see the memory being used/increased/decreased when the prog is being executed. As I understand it, this is a good indication that there might be a problem. Apache::VMonitor is great! (well, I wrote it :) Gregory, before you continue asking more questions... it's all the guide: http://perl.apache.org/release/docs/1.0/guide/performance.html#Measuring_the_Memory_of_the_Process so before you ask, check the guide. Use the search if you don't know where to look. __ 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: Modifying @INC via startup.pl
I added the below STDER statement and did NOT see the printout either on screen or in my error_log file. It sounds like then my startup.pl file is not even being loaded? Funny though I can deliberately put a bogus module name or misspell use stric; and I will be unable to restart the server because of it. Can this file be read and checked for correctness but not loaded? Gregory At 09:57 AM 5/19/2002 +0200, you wrote: At 02:50 19.05.2002, Gregory Matthews wrote: Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. Are you sure you are loading your startup.pl file before your module? Are you sure it's getting loaded at all? Try adding a debug statement in your startup.pl: print STDERR 'Loading startup.pl @INC = ', join :, @INC; after your use lib part. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all PerlSendHeader Off /Directory # end mod_perl setup Thanks everyone. This list is a lifesaver! Gregory -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Modifying @INC via startup.pl
If I run apachectl configtest, I can see the below statement, Loading startup.pl..., so it appears that it is at least reading it (which I knew before), but for some reason, @INC does not show an updated path per my call, use lib qw(...); . In addition, I am using the Apache::DBI module with the Apache::DBI-connect_on_init option, and even though I put in bogus database info, Apache starts fine with no errors? Any ideas on what is going on? Gregory At 09:57 AM 5/19/2002 +0200, you wrote: At 02:50 19.05.2002, Gregory Matthews wrote: Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. Are you sure you are loading your startup.pl file before your module? Are you sure it's getting loaded at all? Try adding a debug statement in your startup.pl: print STDERR 'Loading startup.pl @INC = ', join :, @INC; after your use lib part. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all PerlSendHeader Off /Directory # end mod_perl setup Thanks everyone. This list is a lifesaver! Gregory -- Per Einar Ellefsen [EMAIL PROTECTED]
Re: Modifying @INC via startup.pl
Tom: No, same error_log as usual. I think this problem may have something to do with my host. I am on a virtual private server, not dedicated, although, I do have root access. The way they configure the servers load in a portion of the mod_perl directives before my Location block, i.e., my vhosts.conf call looks like this: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Location /perl PerlFixupHandler Apache::DB SetHandler perl-script PerlHandler Apache::Registry OptionsExecCGI allow from all PerlSendHeaderOff /Location # end mod_perl setup Notice that I do NOT need to call PerlModule Apache::Registry. It is already loaded. I may give up on the startup.pl file and simply add a Perl.../Perl section directly. Will this solve the problem? Gregory At 11:40 AM 5/19/2002 -0700, you wrote: Gregory, are you _sure_ you have the right error_log ? You didn't send mod_perl errors somewhere different from normal? That is my most common reason for not being able to find diagnostic messages... (looking in the normal webserver logs, or the ssl logs, as compared to the mod_perl daemon's error logs) On Sun, 19 May 2002, Per Einar Ellefsen wrote: At 18:57 19.05.2002, Gregory Matthews wrote: I added the below STDER statement and did NOT see the printout either on screen or in my error_log file. It sounds like then my startup.pl file is not even being loaded? Funny though I can deliberately put a bogus module name or misspell use stric; and I will be unable to restart the server because of it. Can this file be read and checked for correctness but not loaded? Wow, now this is weird. Could you try something as simple as file:startup.pl -- use lib qw(/path/to/foo); print STDERR Loading startup.pl; 1; And then load that with PerlRequire? Came to think of it: could you try without Apache::DB? Maybe that's the source of your problems. Finally, as a quick fix to your original problem: maybe you can use PERL5LIB: PerlSetEnv PERL5LIB /path in your httpd.conf. This is all I can come up with, sorry. At 09:57 AM 5/19/2002 +0200, you wrote: At 02:50 19.05.2002, Gregory Matthews wrote: Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. Are you sure you are loading your startup.pl file before your module? Are you sure it's getting loaded at all? Try adding a debug statement in your startup.pl: print STDERR 'Loading startup.pl @INC = ', join :, @INC; after your use lib part. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all PerlSendHeader Off /Directory # end mod_perl setup Thanks everyone. This list is a lifesaver! Gregory -- Per Einar Ellefsen [EMAIL PROTECTED] -- [EMAIL PROTECTED] | What I like about deadlines is the lovely http://BareMetal.com/ | whooshing they make as they rush past. web hosting since '95 | - Douglas Adams
Re: Modifying @INC via startup.pl
Tom: Fixed it. I needed to add a 1; to the end of my startup.pl file. I was using a startup.pl file example from apache.org which did NOT have this. Then in doing some research, found out that it needed it. Now the @INC is being updated at startup. Thanks for your help! Gregory At 11:40 AM 5/19/2002 -0700, you wrote: Gregory, are you _sure_ you have the right error_log ? You didn't send mod_perl errors somewhere different from normal? That is my most common reason for not being able to find diagnostic messages... (looking in the normal webserver logs, or the ssl logs, as compared to the mod_perl daemon's error logs) On Sun, 19 May 2002, Per Einar Ellefsen wrote: At 18:57 19.05.2002, Gregory Matthews wrote: I added the below STDER statement and did NOT see the printout either on screen or in my error_log file. It sounds like then my startup.pl file is not even being loaded? Funny though I can deliberately put a bogus module name or misspell use stric; and I will be unable to restart the server because of it. Can this file be read and checked for correctness but not loaded? Wow, now this is weird. Could you try something as simple as file:startup.pl -- use lib qw(/path/to/foo); print STDERR Loading startup.pl; 1; And then load that with PerlRequire? Came to think of it: could you try without Apache::DB? Maybe that's the source of your problems. Finally, as a quick fix to your original problem: maybe you can use PERL5LIB: PerlSetEnv PERL5LIB /path in your httpd.conf. This is all I can come up with, sorry. At 09:57 AM 5/19/2002 +0200, you wrote: At 02:50 19.05.2002, Gregory Matthews wrote: Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. Are you sure you are loading your startup.pl file before your module? Are you sure it's getting loaded at all? Try adding a debug statement in your startup.pl: print STDERR 'Loading startup.pl @INC = ', join :, @INC; after your use lib part. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all PerlSendHeader Off /Directory # end mod_perl setup Thanks everyone. This list is a lifesaver! Gregory -- Per Einar Ellefsen [EMAIL PROTECTED] -- [EMAIL PROTECTED] | What I like about deadlines is the lovely http://BareMetal.com/ | whooshing they make as they rush past. web hosting since '95 | - Douglas Adams
Re: Modifying @INC via startup.pl
Tom: Here is one of them. I think that I saw it elsewhere also. When I come across the other pages, I will advise. http://perl.apache.org/preview/modperl-site-ok/docs/1.0/guide/config.html#MinSpareServers_MaxSpareServers_StartServers_MaxClients_MaxRequestsPerChild Thanks again Tom! Also, here is another question: I am putting the following in my startup file to initialize a db connection: # Initialize the database connections for each child Apache::DBI-connect_on_init (DBI:mysql:database=test;host=localhost, user,password, { PrintError = 1, # warn() on errors RaiseError = 0, # don't die on error AutoCommit = 1, # commit executes immediately } I am also using the $Apache::DBI::DEBUG = 2; flag to ensure it is working properly. I am NOT seeing the entries in the error_log both when Apache::DBI initializes a connection and when it returns one from its cache. Shouldn't I be able to see a reference to the connection in my error_log file? I checked both my virtual host error_log file and the server error_log file. Nothing in either. Gregory At 10:21 PM 5/19/2002 +0200, you wrote: At 22:03 19.05.2002, Gregory Matthews wrote: Tom: Fixed it. I needed to add a 1; to the end of my startup.pl file. I was using a startup.pl file example from apache.org which did NOT have this. Then in doing some research, found out that it needed it. Now the @INC is being updated at startup. :) Would you mind telling us which exaple it was so that we can fix it? At 11:40 AM 5/19/2002 -0700, you wrote: Gregory, are you _sure_ you have the right error_log ? You didn't send mod_perl errors somewhere different from normal? That is my most common reason for not being able to find diagnostic messages... (looking in the normal webserver logs, or the ssl logs, as compared to the mod_perl daemon's error logs) On Sun, 19 May 2002, Per Einar Ellefsen wrote: At 18:57 19.05.2002, Gregory Matthews wrote: I added the below STDER statement and did NOT see the printout either on screen or in my error_log file. It sounds like then my startup.pl file is not even being loaded? Funny though I can deliberately put a bogus module name or misspell use stric; and I will be unable to restart the server because of it. Can this file be read and checked for correctness but not loaded? Wow, now this is weird. Could you try something as simple as file:startup.pl -- use lib qw(/path/to/foo); print STDERR Loading startup.pl; 1; And then load that with PerlRequire? Came to think of it: could you try without Apache::DB? Maybe that's the source of your problems. Finally, as a quick fix to your original problem: maybe you can use PERL5LIB: PerlSetEnv PERL5LIB /path in your httpd.conf. This is all I can come up with, sorry. At 09:57 AM 5/19/2002 +0200, you wrote: At 02:50 19.05.2002, Gregory Matthews wrote: Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. Are you sure you are loading your startup.pl file before your module? Are you sure it's getting loaded at all? Try adding a debug statement in your startup.pl: print STDERR 'Loading startup.pl @INC = ', join :, @INC; after your use lib part. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all
Re: Modifying @INC via startup.pl
Thanks for the update! Did you get a chance to review the other question I had below? Gregory At 11:53 PM 5/19/2002 +0200, you wrote: Thank you very much Gregory, I have patches the online docs. By the way, the release-ready (almost) site is now at http://perl.apache.org/release/ At 23:36 19.05.2002, Gregory Matthews wrote: Tom: Here is one of them. I think that I saw it elsewhere also. When I come across the other pages, I will advise. http://perl.apache.org/preview/modperl-site-ok/docs/1.0/guide/config.html#MinSpareServers_MaxSpareServers_StartServers_MaxClients_MaxRequestsPerChild Thanks again Tom! Also, here is another question: I am putting the following in my startup file to initialize a db connection: # Initialize the database connections for each child Apache::DBI-connect_on_init (DBI:mysql:database=test;host=localhost, user,password, { PrintError = 1, # warn() on errors RaiseError = 0, # don't die on error AutoCommit = 1, # commit executes immediately } I am also using the $Apache::DBI::DEBUG = 2; flag to ensure it is working properly. I am NOT seeing the entries in the error_log both when Apache::DBI initializes a connection and when it returns one from its cache. Shouldn't I be able to see a reference to the connection in my error_log file? I checked both my virtual host error_log file and the server error_log file. Nothing in either. Gregory At 10:21 PM 5/19/2002 +0200, you wrote: At 22:03 19.05.2002, Gregory Matthews wrote: Tom: Fixed it. I needed to add a 1; to the end of my startup.pl file. I was using a startup.pl file example from apache.org which did NOT have this. Then in doing some research, found out that it needed it. Now the @INC is being updated at startup. :) Would you mind telling us which exaple it was so that we can fix it? At 11:40 AM 5/19/2002 -0700, you wrote: Gregory, are you _sure_ you have the right error_log ? You didn't send mod_perl errors somewhere different from normal? That is my most common reason for not being able to find diagnostic messages... (looking in the normal webserver logs, or the ssl logs, as compared to the mod_perl daemon's error logs) On Sun, 19 May 2002, Per Einar Ellefsen wrote: At 18:57 19.05.2002, Gregory Matthews wrote: I added the below STDER statement and did NOT see the printout either on screen or in my error_log file. It sounds like then my startup.pl file is not even being loaded? Funny though I can deliberately put a bogus module name or misspell use stric; and I will be unable to restart the server because of it. Can this file be read and checked for correctness but not loaded? Wow, now this is weird. Could you try something as simple as file:startup.pl -- use lib qw(/path/to/foo); print STDERR Loading startup.pl; 1; And then load that with PerlRequire? Came to think of it: could you try without Apache::DB? Maybe that's the source of your problems. Finally, as a quick fix to your original problem: maybe you can use PERL5LIB: PerlSetEnv PERL5LIB /path in your httpd.conf. This is all I can come up with, sorry. At 09:57 AM 5/19/2002 +0200, you wrote: At 02:50 19.05.2002, Gregory Matthews wrote: Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. Are you sure you are loading your startup.pl file before your module? Are you sure it's getting loaded at all? Try adding a debug statement in your startup.pl: print STDERR 'Loading startup.pl @INC = ', join :, @INC; after your use lib part. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp
Apache::Leak
Hello again. Is Apache::Leak the easiest/best module to use for both detecting AND allowing us to find the source of a memory leak in mod_perl? If so, I am not finding any good documentation on its use. I am not a mod_perl guru and what I've read so far sounds rather involved. Can someone point me to a location where good, laymen documentation exists for this module. I would love to use it to ensure my code is solid (I am writing a mod_perl app from scratch and do not want to stray off the wrong coding path). Thanks in advance. Gregory
Memory Leaks
I have a couple of questions regarding leaking memory in mod_perl: 1. What are the main culprits, in order of severity, of memory leaks, i.e.: a. global variables (NOT lexically scoped via my) b. ... c. ... 2. When writing code from scratch (a new application), what is the best way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn On, etc.. ? I posted an earlier question regarding Apache::Leak which I am hoping to receive some positive input. I would like to check my final product once completed to ensure no leaks exist. Thanks everyone. Gregory
Re: Memory Leaks
So am I being overly paranoid concerning the leak potential of mod_perl programming? If I start with strict code to begin with and try my best to stay away from the problems you mentioned, then any potential memory leak/drain issues will be avoided? Keep in mind, although my application is not designed to launch the space shuttle, I do want it to be solid/stable/peformance-packed from the ground up. I will be also be using MySql with the Apache::DBI module. Thanks in advance. Gregory At 11:34 PM 5/19/2002 -0400, you wrote: I have a couple of questions regarding leaking memory in mod_perl: 1. What are the main culprits, in order of severity, of memory leaks, i.e.: a. global variables (NOT lexically scoped via my) b. ... c. ... 2. When writing code from scratch (a new application), what is the best way to avoid creating leaks to begin with, i.e., use strict;, PerlWarn On, etc.. ? There are actually not very many ways you can leak memory in Perl (and thus mod_perl). Most people confuse memory growth with memory leakage. If you want to know how to avoid memory growth, look at the performance tuning stuff in the Guide, like passing references, avoiding slurping of large files, controlling the buffering of DBI result sets, etc. Leaks are caused by circular references, the string form of eval (at least it used to leak a little), nested closures (sometimes created accidentally with the Error module), and one or two obscure syntax problems. I think one of them involved code like my $x = 7 if $y;. Matt Sergeant got bitten by this in the early stages of AxKit development, and the details are in the mailing list archive. Global variables by themselves are not a source of leaks or growth. If you slurp a large file into a global, your process will grow, but the same is true for a lexical. - Perrin
Apache::DBI
Hello again: I figured out my Apache::DB problem with the help from Stas Bekman. Thanks! Now on to Apache::DBI. The documentation says NOT to use this module IF you are opening a special connection for each of your users. Does this mean if each user has to use a unique username/password to OPEN the database? My prog will use the same database:username:password for all connection requests opened with a db_connect($database,$user,$password) call, however, each user will have his/her own unique file/table within this database which requires a unique username/password to access. I am assuming that this means I CAN use the Apache::DBI module. Please advise. Thanks! Gregory
Re: Apache::DB
At 01:30 AM 5/18/2002 +0800, you wrote: [please don't forget that to CC the list!] Gregory Matthews wrote: Stas: Thanks for your reply on my issue in the Mod_Perl list. Excuse my ignorance, but how do I do the following: before you try to build Apache::DB try to build test.c with the contents: #include time.h int main(void){return 0;} and then compile it: % cc test.c If you could point me in the right direction, I can figure it out! I am running FreeBSD. Thanks. Gregory create a file named test.c, put inside: include time.h int main(void){return 0;} now you need to compile it with: cc test.c if this doesn't work (i.e. you get compilation errors, you have to ask for assistance on the FreeBSD mailing list(s) or elsewhere, since your problem has nothing to do with mod_perl. __ 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::DBI
Perrin: Yes, my prog checks for valid username/password requests and issues the proper response. So it sounds like Apache::DBI is a good solution then since all users will be working under the same handle? Gregory At 02:03 PM 5/18/2002 -0400, you wrote: Gregory Matthews wrote: Does this mean if each user has to use a unique username/password to OPEN the database? Yes, eaxctly. My prog will use the same database:username:password for all connection requests opened with a db_connect($database,$user,$password) call, however, each user will have his/her own unique file/table within this database which requires a unique username/password to access. So that security is handled by your program, not by the database? No problem for Apache::DBI logins then. - Perrin
error_log contents
I am getting the following repeating code in my error log in doing some testing on my script: DB1 DB1 DB1 DB1 DB1 DB1 DB1 DB1 Does anyone know what this means? It seems to go away when I restart apache. Gregory
Modifying @INC via startup.pl
I am trying to: use lib qw(/dir/foo); in my startup.pl file but INC is NOT showing the path. I keep getting Can't locate config.pl in INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. INC shows: (INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all PerlSendHeader Off /Directory # end mod_perl setup Thanks everyone. This list is a lifesaver! Gregory
Re: Apache::DB
Stas: Thanks again! Gregory At 01:30 AM 5/18/2002 +0800, you wrote: [please don't forget that to CC the list!] Gregory Matthews wrote: Stas: Thanks for your reply on my issue in the Mod_Perl list. Excuse my ignorance, but how do I do the following: before you try to build Apache::DB try to build test.c with the contents: #include time.h int main(void){return 0;} and then compile it: % cc test.c If you could point me in the right direction, I can figure it out! I am running FreeBSD. Thanks. Gregory create a file named test.c, put inside: include time.h int main(void){return 0;} now you need to compile it with: cc test.c if this doesn't work (i.e. you get compilation errors, you have to ask for assistance on the FreeBSD mailing list(s) or elsewhere, since your problem has nothing to do with mod_perl. __ 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: Modifying @INC via startup.pl
Tried that...doesn't work either. @INC still cannot find my config.pl file. If I add the use lib statement to my script, all is o.k.. If I try to add it to my startup.pl and call it at startup time, I get the error from @INC. At 06:16 PM 5/18/2002 -0400, you wrote: I did this: use lib qw(path to files); That adds the path to @INC. Someone correct me if that's the wrong way to do things - Original Message - From: Gregory Matthews [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, May 18, 2002 6:12 PM Subject: Modifying @INC via startup.pl I am trying to: use lib qw(/dir/foo); in my startup.pl file but @INC is NOT showing the path. I keep getting Can't locate config.pl in @INC errors after restarting the server and calling the script. My prog reads: require qq(config.pl); I am not sure what is going on. @INC shows: (@INC contains: /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/local/www/ /usr/local/www/lib/perl) at (eval 265) line 22. Why is the path to config.pl not showing up? My defaults.conf reads: # mod_perl setup Alias /perl /usr/local/www/vhosts/host.com/perl PerlRequire /usr/local/www/vhosts/host.com/perl/libs/startup.pl PerlSetEnv PERLDB_OPTS NonStop=1 LineInfo=/tmp/db.out AutoTrace=1 frame=2 PerlModule Apache::DB PerlWarn On PerlTaintCheck On Directory /usr/local/www/vhosts/host.com/perl PerlFixupHandler +Apache::DB SetHandler perl-script PerlHandler +Apache::Registry Options +ExecCGI allow from all PerlSendHeader Off /Directory # end mod_perl setup Thanks everyone. This list is a lifesaver! Gregory
Apache::DB
Hello All. I am trying to install Apache::DB and am getting the following error: + make test cc -c-DVERSION=\0.06\ -DXS_VERSION=\0.06\ -DPIC -fpic -I/usr/libdata/perl/5.00503/mach/CORE DB.c In file included from /usr/include/sys/time.h:289, from /usr/include/sys/stat.h:50, from /usr/include/sys/mount.h:44, from /usr/libdata/perl/5.00503/mach/CORE/perl.h:376, from DB.xs:2: /usr/include/time.h:2: syntax error before `1989' /usr/include/time.h:26: empty character constant /usr/include/time.h:32: syntax error before `PROFITS' /usr/include/time.h:115: syntax error before `}' *** Error code 1 Stop in /usr/home/goxcom/Perl_Modules/Apache-DB-0.06/Apache-DB-0.06. + Any ideas? I downloaded from CPAN, and also tried to install directly from my shell. Thanks in advance. I really want to use this as my mod_perl debugger! Gregory