Page 1 of 1

what happens when an infinite loop occurs on a server?

Posted: Fri Nov 30, 2007 10:58 pm
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?

Posted: Fri Nov 30, 2007 11:06 pm
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.

Posted: Sat Dec 01, 2007 9:28 am
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.

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

Posted: Sat Dec 01, 2007 1:24 pm
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.

Posted: Mon Dec 03, 2007 5:36 am
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?

Posted: Mon Dec 03, 2007 9:27 am
by feyd
infinite loops due tend to peg CPUs to 100%, yes.

Posted: Mon Dec 03, 2007 10:37 pm
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);