Page 1 of 1
Site hiccup! Back to normal now.
Posted: Sat Aug 02, 2008 6:42 pm
by seraph0x
Hey folks,
The server had a hiccup today and became fairly unstable, but we should be back to normal now and I learned some valuable lessons to avoid this type of problem in the future.
Live and learn!
Cheers,
Seraph0x

Re: Site hiccup! Back to normal now.
Posted: Sat Aug 02, 2008 6:44 pm
by Foxhawke
You don't want to share your lessons? :)
Re: Site hiccup! Back to normal now.
Posted: Sat Aug 02, 2008 6:59 pm
by seraph0x
Foxhawke wrote:You don't want to share your lessons? :)
Well, if you're interested, here goes:
Code: Select all
function cut_at_word($text, $len) {
$text = str_replace('<br />', ' ', $text);
$text = preg_replace('/\<.*?\>/', '', $text);
if(strlen($text) <= $len) return $text;
$i = $len;
while(substr($text, $i, 1) != ' ') {
$i--;
}
return substr($text, 0, $i).'...';
}
Anybody see anything wrong with that code?
Solution below (click and drag from * to *):
*
The while loop never ends if the text doesn't contain a space. Since this function was used to truncate posts for the front page, the front page would hang every time when the latest post didn't have a space in it.*
Explanation for non-geeks: Princess Christie unintentionally and completely innocently took down our server using
this post. This was possible due to a programming mistake I made and which is now fixed.

Re: Site hiccup! Back to normal now.
Posted: Sat Aug 02, 2008 10:53 pm
by funden
Hihi

Re: Site hiccup! Back to normal now.
Posted: Sun Aug 03, 2008 4:09 am
by Mz_Teneale
I still dont know what Phoxy is talking about....
Ill just smile and nod,

Re: Site hiccup! Back to normal now.
Posted: Sun Aug 03, 2008 11:04 am
by Foxhawke
seraph0x wrote:Anybody see anything wrong with that code?
Hehe, that's a classic.

I do php coding (amongst other things) for a living and I've done similar errors myself. Loops can be dangerous stuff.

Re: Site hiccup! Back to normal now.
Posted: Mon Aug 04, 2008 11:36 am
by omssx
Hehe ive done the un-ending loop before too...
I was making an email bomb (i know i know, not good but he deserved it, cheating, woman abusing scum bag!) and the idea was to have the $i value be set by me to something like 10 and the loop would run 10 times and send 10 emails... Well i forgot to add the line that takes 1 away from the $1 variable... So the loop ran forver. not too bad you might think, until i tell you that i was testing it on my own email address and ended up with literally hundreds of emails a minute! Luckily i was just testing it on a lycos tripod free account so i had to delete my account, and the emails still carried on for a few minutes until the server truly destroyed my scripts. Haha!
It wasnt pretty! I was on MSN at the time and the emails were so fast that as soon as one alert disappeared i had another. I cant remember how many emails i got in the end but it was several pages worth :D
anyway, glad you got it sorted in the end!
Re: Site hiccup! Back to normal now.
Posted: Mon Aug 04, 2008 12:50 pm
by seraph0x
Hehe, glad a few of the techies got a kick out of it.
Everyone else: Don't worry, I'm
not about to turn Milovana into a blog about programming.

Re: Site hiccup! Back to normal now.
Posted: Mon Aug 04, 2008 6:53 pm
by Jaberwocky
omssx, I know another way to create some email issues...
Situation:
An email server that was on the agenda to be replaced by a newer program, and more than one mail-domain.
Here is what a user did:
- He wrote an out of office notification rule to automatically reply to people that he is on vacation
- No wait, he wrote a second, slightly different rule, as well!
- He tested it by sending himself an email
- He took a plane out of the country
It was not just a regular email bouncing around, but a multiplying bouncing email! Log on to the mailserver or the spamfilter was difficult because the system was for some reasosn pre-occupied. After two days, 250,000 emails have passed the spamfilter, and 620,000 emails were still in queue.
Thank god it happened to a collegue of mine.
Re: Site hiccup! Back to normal now.
Posted: Mon Aug 04, 2008 8:04 pm
by Foxhawke
seraph0x wrote:Everyone else: Don't worry, I'm
not about to turn Milovana into a blog about programming.

Aww, such a tease!

Re: Site hiccup! Back to normal now.
Posted: Tue Aug 05, 2008 1:32 pm
by omssx
After two days, 250,000 emails have passed the spamfilter, and 620,000 emails were still in queue.
hahaha damn i bet that hurt when he got back!
Good way to disrupt a mail server though! Ill remember that ;)
Re: Site hiccup! Back to normal now.
Posted: Tue Aug 05, 2008 11:34 pm
by Foxhawke
omssx wrote:Good way to disrupt a mail server though! Ill remember that ;)
Doesn't work nearly as well anymore. Mailservers are much better at handling large amounts of emails suddenly appearing and will usually discard them and blacklist the sender (the server, not the email) for a while (a few hours to a few days or more). In this day and age when spam is such a rampart problem these things doesn't work nearly as well as they used to five or ten years ago.