Oliver Spiesshofer <ol****@email.com> writes:
I made a mistake in a script that completely froze my linux-based server:
I passed an array instead of a number to a function like:
function plg_ratingimg($rating)
{
global $plug_picrank;
for ($i=0;$i<$rating;$i++)
$out.=$plug_picrank;
Assuming this thing iterated a bazillion times, at least during the
PHP configured max script execution time, it busied the CPU to 100%
and also consumed a huge amount of memory.
Not sure if your PHP might be configured to have large amount of
memory available but a runaway loop like this can certainly cause a
server to THRASH, though probably not crash (as you have suggested).
Suspect the memory use put you over the acceptable paging limit for
this box.
Why don't you log into the machine interactively with telnet, SSH or
similar, run the defective PHP script and see what happens. Does your
Linux panic and halt? Or does the machine just go catatonic for a
while.
Can you see the machine physically and check for excessibe disk
activity which would indicate rapid paging.
If the interactive session does continue to respond, top, vmstat and
various other diagnostic tools can help you learn what's really
happening.
HTH
--
-------------------------------------------------------------------------------
Jerry Sievers 305 854-3001 (home) WWW ECommerce Consultant
305 321-1144 (mobile
http://www.JerrySievers.com/