homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

Can badly behaved scripts cause widespread problems
I'm having trouble with my host.

 9:44 am on Dec 27, 2004 (gmt 0)

I only use form mail and counters on my site. From time to time (and several times in the last few days) my counter files have dropped to zero-length. Bizarrely, at one point, my site was wholly invisible to Firefox (but could be seen by IE - both caches having been cleared). Also, I am often unable to access my email and emails sent out may not actually be despatched for up to 24 hours.

So much for the symptoms. My question is this. Could these faults be caused by bugs in my scripts? My feeling is the answer is "no", but before I through a major wobbly with my host, I thought I would ask for expert opinions here first.

NOTE: I wrote both counter and form-mail scripts myself.




 2:41 pm on Dec 27, 2004 (gmt 0)

Are you using mod_perl? Is your formmailer synchronous (e.g., sends the mail immediately and waits for an answer from the mailserver) or does it put the mail into some queue with zero waiting?

How is the counter embedded in the HTML? Does the page generator wait until the counter has incremented its count in the DB? If the content gets cached, this could lead to 0 bytes sent to the browser until the counter has finished.

IMO it *could* be some misbehaving CGIs that result in a kind of DOS attack.


 6:41 pm on Dec 27, 2004 (gmt 0)

Or your server disk space could be full, or at least the part alotted to your domain or the virtual domain directory. This would cause any of the above symptoms. A file get opened for writing, it attempts to write to it, system says full disk, it closes it flushed. I've been "fortunate" :-) enough to encounter this many times. More often than not it's on a limited-space domain and the cuplrit is per-domain usage logs.


 11:16 pm on Dec 27, 2004 (gmt 0)

Thanks for the suggestions. To answer questions

1) Using standard Perl only (not mod_perl).
2) Using smtp module (rather than SendMail).
3) Using javascript to include counters in html (I've been thinking of changing this).
4) All counters disable caching.
5) Checked log files - one has been zeroed recently : very interesting!


PS How to I check the length of a file. My counters are self-repairing except if a zero-length file exists - DRAT!


 1:51 am on Dec 28, 2004 (gmt 0)

@stat = stat("$your_file");
if (! ($stat[7]>0)) { print "Empty file!"; }

Look up stat, it's a 12 item array with lots of info about a file, including lastmod and other goodies, it's good to get in the habit of using it. If all you want is size

$f_size = -s "$your_file";
if (! ($f_size > 0)) { print "It's still empty!"; }


 10:13 am on Dec 28, 2004 (gmt 0)

Thanks... I'm away from home but I'll add this fix in the New Year.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved