Site hiccup! Back to normal now.

You can find important news and current events here.
Locked
seraph0x
Administrator
Administrator
Posts: 2654
Joined: Sun Jul 23, 2006 8:58 am

Site hiccup! Back to normal now.

Post 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 :-)
Foxhawke
Explorer At Heart
Explorer At Heart
Posts: 457
Joined: Fri Aug 10, 2007 8:59 pm

Re: Site hiccup! Back to normal now.

Post by Foxhawke »

You don't want to share your lessons? :)
seraph0x
Administrator
Administrator
Posts: 2654
Joined: Sun Jul 23, 2006 8:58 am

Re: Site hiccup! Back to normal now.

Post 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. :-D
funden
Explorer
Explorer
Posts: 21
Joined: Sat Sep 02, 2006 2:14 pm

Re: Site hiccup! Back to normal now.

Post by funden »

Hihi :-P
jp
Community Manager
Community Manager
Posts: 995
Joined: Sat Sep 30, 2006 3:57 am
Gender: Male
Sexual Orientation: Straight
I am a: None of the above
Location: Midwest USA

Re: Site hiccup! Back to normal now.

Post by jp »

Well, I'd much rather a programming error than another DoS attack, which is what I figured had happened.

Nice work getting that fixed.

(And being a programmer myself, I'm a bit ashamed to say I didn't see the error before highlighting the fix. To my credit though, I don't even recognize that language.)
Mz_Teneale
Resident Mistress
Resident Mistress
Posts: 352
Joined: Sat Oct 21, 2006 5:49 am
Location: Australia
Contact:

Re: Site hiccup! Back to normal now.

Post by Mz_Teneale »

I still dont know what Phoxy is talking about....

Ill just smile and nod, :yes:
The Mistress From Oz
Foxhawke
Explorer At Heart
Explorer At Heart
Posts: 457
Joined: Fri Aug 10, 2007 8:59 pm

Re: Site hiccup! Back to normal now.

Post 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. ;-)
omssx
Explorer At Heart
Explorer At Heart
Posts: 177
Joined: Sat Dec 02, 2006 9:08 pm

Re: Site hiccup! Back to normal now.

Post 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!
seraph0x
Administrator
Administrator
Posts: 2654
Joined: Sun Jul 23, 2006 8:58 am

Re: Site hiccup! Back to normal now.

Post by seraph0x »

Hehe, glad a few of the techies got a kick out of it. :wave:

Everyone else: Don't worry, I'm not about to turn Milovana into a blog about programming. ;-)
User avatar
Jaberwocky
Explorer At Heart
Explorer At Heart
Posts: 314
Joined: Fri Dec 29, 2006 11:32 pm
Gender: Male
Sexual Orientation: Straight
I am a: Submissive
Location: The Netherlands

Re: Site hiccup! Back to normal now.

Post 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.
Foxhawke
Explorer At Heart
Explorer At Heart
Posts: 457
Joined: Fri Aug 10, 2007 8:59 pm

Re: Site hiccup! Back to normal now.

Post 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! :lol:
omssx
Explorer At Heart
Explorer At Heart
Posts: 177
Joined: Sat Dec 02, 2006 9:08 pm

Re: Site hiccup! Back to normal now.

Post 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 ;)
Foxhawke
Explorer At Heart
Explorer At Heart
Posts: 457
Joined: Fri Aug 10, 2007 8:59 pm

Re: Site hiccup! Back to normal now.

Post 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.
Locked

Who is online

Users browsing this forum: No registered users and 4 guests