[Labs-l] User query-guard for sql tasks gone wild

Magnus Manske magnusmanske at googlemail.com
Tue May 6 14:09:28 UTC 2014


Thanks, I am trying this for my notorious catscan2 now :-)


On Tue, May 6, 2014 at 2:26 PM, Hedonil <hedonil at action.ms> wrote:

> In relation to current events, sometimes sql-queries may go wild and
> clog/block other task.
> Especially endangered species are queries from web/user interfaces,
> which can become quite unpredictable at some time.
> For example
> - PHP has a default timeout of 30 seconds for pure script execution
> (wait conditions excluded),
> - lighttpd has a default write-idle timeout of 360 seconds
> - in some cases you'll receive a 504 proxy-(gateway)-timeout
> - or the user cancels his webrequest in his browser
> in all cases, it's pointless to wait for the result, as it will never be
> shown, but the sql-query lives on.
>
> Of course, better coding is the best solution, but some cases are hard
> to predict / detect.
> To address this issue, I wrote a script that guards the current
> sql-queries on a per user basis and nukes 'em after a configurable timeout.
>
> As commented in the script:
> To avoid killing useful maintenance tasks, it'd be best to mark your
> user/web-queries with a comment (/* foo */ ) to tell long running god
> ones from bad ones. This can also be configured in the script.
>
> The script is available here:
> /shared/sample_scripts/query-guard.sh
> or here
> https://tools.wmflabs.org/tools-info/misc/query-guard.sh
>
> -Hedonil
>
> _______________________________________________
> Labs-l mailing list
> Labs-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/labs-l
>



-- 
undefined
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wikimedia.org/pipermail/labs-l/attachments/20140506/4f0a2ef4/attachment.html>


More information about the Labs-l mailing list