what happens when an infinite loop occurs on a server?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
iceangel89
Forum Commoner
Posts: 39
Joined: Mon Jul 02, 2007 7:02 pm

what happens when an infinite loop occurs on a server?

Post by iceangel89 »

what happens when an infinite loop occurs on a server?

on my local machine, WinXP + WAMP5, i get a Fatal Error something abt max execution time of 30secs exceeded on a real server what implications does it have?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Most likely it will terminate after 30 seconds (php.ini default setting).. but it all depends on the configuration of your server.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Actually, when this happens in real life, the Earth's rotation slows just a bit and the gravitational imbalance brings us closer to the sun.

In reality, it would have everything to do with your server settings. If you are on a hosted server, it would probably die in about 30 seconds. If it is your own server, and you tweaked the settings... well, fasten your seatbelt because it might be getting a little warmer around here.
User avatar
Josh1billion
Forum Contributor
Posts: 316
Joined: Tue Sep 11, 2007 3:25 pm

Re: what happens when an infinite loop occurs on a server?

Post by Josh1billion »

iceangel89 wrote:on my local machine, WinXP + WAMP5, i get a Fatal Error something abt max execution time of 30secs exceeded on a real server what implications does it have?
As the others said, same thing usually.
iceangel89
Forum Commoner
Posts: 39
Joined: Mon Jul 02, 2007 7:02 pm

Post by iceangel89 »

ok thanks just dont want to crash servers. remote ones. someone(http://nicheserver.com) kindly gave me free hosting so dont want to cause him any trouble, crashing servers. lol.

but just curious during the 30secs what happens 100% CPU usage? won't that be bad still?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

infinite loops due tend to peg CPUs to 100%, yes.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

An infinite loop for 30 seconds will not be so bad and provided your loop isn't building a stack or something which uses a lot of memory the only impact will be a slowdown on the server. If you're really concerned then you can get away with a 5-10 second time limit in most scripts which don't do any heavy work on remote connections.

Code: Select all

set_time_limit(5);
Post Reply