Advice for programmers...
May. 16th, 2007 10:09 pmWhen you have a loop in your code, make sure it has an exit condition that will always occur.
I though I was the victim of a DoS attack on one of my websites, but it turned out to be entirely self inflicted.
I though I was the victim of a DoS attack on one of my websites, but it turned out to be entirely self inflicted.
no subject
Date: 2007-05-18 11:01 pm (UTC)no subject
Date: 2007-05-19 12:36 am (UTC)When the code is generating part of a web page, however, infinite loops are very bad indeed. Every time the page is loaded it will create a new thread of execution, tying up server resources and never giving them back, until the server has no more resources to give. As every iteration of the loop was writing a line to my error log, this also grew at an alarming rate, writing 10GB to the log in a matter of minutes.
It was also consuming 100% of CPU resources, so if I hadn't dealt with it quickly I expect my webhost would have been none to happy.