<div dir="ltr">Thanks, I am trying this for my notorious catscan2 now :-)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 6, 2014 at 2:26 PM, Hedonil <span dir="ltr"><<a href="mailto:hedonil@action.ms" target="_blank">hedonil@action.ms</a>></span> wrote:<br>

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