I think at the database level you can tell it to cease if there is a query which goes on for more than x milliseconds. http://mtop.sourceforge.net/ mkill can kill long running mysql queries. In postgres it's a configuration parameter: http://www.postgresql.org/docs/8.3/static/runtime-config-client.html#GUC-STA... Caleb Flavius Olaru wrote:
Hi,
I've done a installation on my localhost (Windows XP machine) of XE 2.1.1, Tomcat 6 and MySQL 5.1. After this i wrote a bad hql query and executed it which brought MySQL to spyke the CPU usage to 100% and even more rendering both the localhost and database unusable.
{{velocity}} #set($badhql = ", BaseObject obj, StringProperty stringprop, LargeStringProperty largestringprop where (doc.name like '%$text%' or doc.content like '%$text%') or (obj.name=doc.fullName and stringprop.id.id=obj.id and stringprop.value like '%$text%') or (obj.name=doc.fullName and largestringprop.id.id=obj.id and largestringprop.value like '%$text%')") #set($ok = $list.addAll(0, $xwiki.searchDocuments("$badhql")))
{{include document="XWiki.Results"/}} {{/velocity}}
The bad thing is that $xwiki.searchDocuments brought me to this state (no programming rights.). Now my question is: Are there any remedies against this? MySQL configuration statements that prevent this kind of behaviour?