For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2007 > Apache ate my hard drive! (and questions)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Apache ate my hard drive! (and questions)
Inventor

2007-07-18, 6:59 pm

While enthusiastically writing my new program, I was having so much
fun coding and reading www.perl.com articles that I didn't notice a
slow, creeping horror that was gradually building up on my machine.
Luckily I was reading about apache and the log files when I remembered
that someone here advised me to check the error logs as standard
practice. As I paged through the file using the more command, I
noticed the little 0% indicator never got bigger than 0% for some
reason. Suddenly realizing my peril i held the spacebar down and
reams of text scrolled by but that 0% never went up! A quick ls -l
revealed that the error file had been slowly growing to as size of 2.2
gigabytes during Apache's first w of running! In my newbiness I
did not realize that all those undeclared variables in a number
crunching program were creating error messages from Hades that were
eating up my little hard drive fast! Fortunately the problem was
caught in time and easily fixed. It only took a few hours to delete
the error file and clean up the code, and now the program runs much
faster as well. Whew! I hope you got a chuckle out of that little
adventure. Now to my questions.

My program accesses small text configuration files, allowing the user
to change them with a CGI interface before writing them out and doing
its compute thing. The problem is that each user needs to have their
own set of configuration files so that the users don't all step on
each other's configuration. I would like for each user to be able to
return again and again and always find their configuration files still
on the server, eagerly awaiting their chance to be accessed yet
again.

I imagine I need some sort of authentication system, but the prospect
of writing one seems daunting. Are there any modules for doing that?
I looked on CPAN and didn't find much of anything obvious.

Should I make copies of the files with username.config.txt or
something like that?

What is the best way to do the copying in Perl?

Do you have any thoughts or suggestions about how to set this up
properly? I'm kind of uncertain about how to proceed.

Thanks in advance.

Rob Dixon

2007-07-18, 6:59 pm

Inventor wrote:
>

[snip apache tragedy]
>
> My program accesses small text configuration files, allowing the user
> to change them with a CGI interface before writing them out and doing
> its compute thing. The problem is that each user needs to have their
> own set of configuration files so that the users don't all step on
> each other's configuration. I would like for each user to be able to
> return again and again and always find their configuration files still
> on the server, eagerly awaiting their chance to be accessed yet
> again.
>
> I imagine I need some sort of authentication system, but the prospect
> of writing one seems daunting. Are there any modules for doing that?
> I looked on CPAN and didn't find much of anything obvious.
>
> Should I make copies of the files with username.config.txt or
> something like that?
>
> What is the best way to do the copying in Perl?
>
> Do you have any thoughts or suggestions about how to set this up
> properly? I'm kind of uncertain about how to proceed.


It sounds like cookies will do what you want? That way the configuration
is stored on the client machine and your CGI code doesn't have to worry
about keeping track of the information. You don't even need an authentication
system unless you need better security.

Rob
Jeff Pang

2007-07-18, 6:59 pm


--- Inventor <Inventor-66@comcast.net> wrote:

> While enthusiastically writing my new program, I was
> having so much
> fun coding and reading www.perl.com articles that I
> didn't notice a
> slow, creeping horror that was gradually building up
> on my machine.
> Luckily I was reading about apache and the log files
> when I remembered
> that someone here advised me to check the error logs
> as standard
> practice. As I paged through the file using the
> more command, I
> noticed the little 0% indicator never got bigger
> than 0% for some
> reason. Suddenly realizing my peril i held the
> spacebar down and
> reams of text scrolled by but that 0% never went up!
> A quick ls -l
> revealed that the error file had been slowly growing
> to as size of 2.2
> gigabytes during Apache's first w of running! In
> my newbiness I
> did not realize that all those undeclared variables
> in a number
> crunching program were creating error messages from
> Hades that were
> eating up my little hard drive fast! Fortunately
> the problem was
> caught in time and easily fixed. It only took a few
> hours to delete
> the error file and clean up the code, and now the
> program runs much
> faster as well. Whew! I hope you got a chuckle out
> of that little
> adventure. Now to my questions.


Glad to hear that you've resolved it.
When you put 'use strict' and 'use warnings' at the
begin of the script,and you run it before apache,you
would find most of the errors.

> I imagine I need some sort of authentication system,
> but the prospect
> of writing one seems daunting. Are there any
> modules for doing that?
> I looked on CPAN and didn't find much of anything
> obvious.


Each user maintain a config file,surely Perl CGI can
handle this well.But rather than config files,using
database is maybe better choice?

>
> Should I make copies of the files with
> username.config.txt or
> something like that?


If there aren't people have the same name,it's
well.But if there's the possiblity there're two guys
have the same name,you may consider other ways like a
random string or auto_increment int ID.

>
> What is the best way to do the copying in Perl?
>

File::Copy can do that well.

Good luck.



________________________________________
________________________________________
____
Luggage? GPS? Comic books?
Check out fitting gifts for grads at Yahoo! Search
http://search.yahoo.com/search?fr=o...ion+gifts&cs=bz
Mr. Shawn H. Corey

2007-07-18, 6:59 pm

Inventor wrote:
> While enthusiastically writing my new program, I was having so much
> fun coding and reading www.perl.com articles that I didn't notice a
> slow, creeping horror that was gradually building up on my machine.
> Luckily I was reading about apache and the log files when I remembered
> that someone here advised me to check the error logs as standard
> practice. As I paged through the file using the more command, I
> noticed the little 0% indicator never got bigger than 0% for some
> reason. Suddenly realizing my peril i held the spacebar down and
> reams of text scrolled by but that 0% never went up! A quick ls -l
> revealed that the error file had been slowly growing to as size of 2.2
> gigabytes during Apache's first w of running! In my newbiness I
> did not realize that all those undeclared variables in a number
> crunching program were creating error messages from Hades that were
> eating up my little hard drive fast! Fortunately the problem was
> caught in time and easily fixed. It only took a few hours to delete
> the error file and clean up the code, and now the program runs much
> faster as well. Whew! I hope you got a chuckle out of that little
> adventure. Now to my questions.


I don't know much about Apache, just what I read in the documentation.
Apache, by default, rolls over its error.log and access.log once a
month. That means you can go back 11 months. January's log replaces
last year's January log, etc. You can set it to roll over wly, or
even daily. I can't tell you the exact command to do this; you'll have
to look it up yourself.

>
> My program accesses small text configuration files, allowing the user
> to change them with a CGI interface before writing them out and doing
> its compute thing. The problem is that each user needs to have their
> own set of configuration files so that the users don't all step on
> each other's configuration. I would like for each user to be able to
> return again and again and always find their configuration files still
> on the server, eagerly awaiting their chance to be accessed yet
> again.


Cookies are the answer.

I have worked on web sites, that for political reasons, can not use
cookies. They're a pain to maintain since you have to give every
"session" a unique ID. The problem is that old IDs get cached (and
sometimes re-used) and then you get complaints that you site is not
working properly. Or worst, it sends info to the wrong place.

>
> I imagine I need some sort of authentication system, but the prospect
> of writing one seems daunting. Are there any modules for doing that?
> I looked on CPAN and didn't find much of anything obvious.


I haven't done this but the best method is to use https rather than the
old method of htaccess.

>
> Should I make copies of the files with username.config.txt or
> something like that?
>
> What is the best way to do the copying in Perl?


See `perldoc File::Copy`.

>
> Do you have any thoughts or suggestions about how to set this up
> properly? I'm kind of uncertain about how to proceed.


Set up a local apache for: development and test. Set up apache for beta
and production. Set up automatic bug reporting for test and beta.

>
> Thanks in advance.
>
>


--
Just my 0.00000002 million dollars worth,
Shawn

"For the things we have to learn before we can do them, we learn by
doing them."
Aristotle
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com