Page MenuHomePhabricator

Allow cancelling / aborting queries
Open, Stalled, NormalPublic

Description

Most of the time, I expect a query to run in less than a second. If it takes longer than that, I assume that I’ve accidentally made an expensive query. In that case, a) I need to make it less expensive (e. g. a LIMIT clause), and b) I don’t actually need WDQS to run the query until it hits the time limit. And that’s always a crappy feeling when I realize that WDQS is now going to unnecessarily labor for 30 seconds (full load, presumably). Adding a button to cancel / abort a running query would take load off the service and allow the user to run the improved query earlier.

Event Timeline

Restricted Application added projects: Wikidata, Discovery. · View Herald TranscriptMay 28 2016, 1:30 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald Transcript
Nikki added a subscriber: Nikki.May 30 2016, 11:31 AM

I wanted to ask for pretty much the same thing. :) I often make stupid mistakes that mean my query will either time out or return far too many results. It used to be possible to just click "Run" again, but now that button gets disabled until it returns results or times out, so once I've fixed the mistake, there's a long delay before I can run my new query.

I'm not really bothered about specifically having a button to stop a query, but I would really like to be able to start the new query without a long delay. For me, it would be ideal if the "Run" button were re-enabled when the query changes (and if the user runs the new query before the old one finishes/times out, silently cancel the old query).

@Smalyshev: Good to know. So the client would send the cancel request while the query GET request is still pending, and that would then return… 204 No Content? 408 Request Timeout? (I suppose it doesn’t matter – the client knows it canceled the query, it doesn’t need to check the response to detect that.)

@Nikki: One workaround is to open a new query tab ;) Ctrl+L,C,T,V, Enter.

Do we know that such queries have a big performance hit or cause undue strain on the servers? I agree that in an ideal world this feature would be useful, but if these queries are not causing any significant issues then practically speaking it may not be worth investing engineering time in such a feature.

Another note: cancel requires POST support as it seems, which currently is not supported. Also, since we have more than one server, we need some kind of affinity on Varnish side, which I am not sure whether we have or not.

@Deskana one query is probably no big deal. Lots of heavy queries can be a problem. But those are usually not from GUI but from bots.

Nikki added a comment.May 31 2016, 8:44 PM

I usually end up right clicking the tab and duplicating it, that way I don't lose what I currently have on the clipboard. :) I suppose refreshing the page would work too but I never trust browsers/pages to not lose something if I do that.

Also, I didn't mention why what I suggested would be ideal (for me): Most of the options (deciding to sit and wait (and succeeding in doing that without getting distracted by something else ;)), clicking a stop button, refreshing or opening a new tab) need some kind of deliberate action from me, which interrupts what I'm doing. What I suggested would be unobtrusive - I could just continue editing and running the query until I get the results I want without it interrupting me.

When I hit that problem I just press F5 to reload the page, because the query in the editor is still preserved.

I am not sure if canceling the query is worth the effort at the moment, because of the strict Blazegraph execution limit.
In the future when that limit will be greater we might want to think about canceling queries.

I usually introduce some error in query and then press Run :)

Smalyshev triaged this task as Normal priority.Sep 12 2016, 10:37 PM

Change 316042 had a related patch set uploaded (by Smalyshev):
Add URL to cancel running query

https://gerrit.wikimedia.org/r/316042

Change 316044 had a related patch set uploaded (by Smalyshev):
Add ability to cancel queries

https://gerrit.wikimedia.org/r/316044

Smalyshev changed the status of subtask T112151: Support POST for SPARQL query endpoint from Stalled to Open.Jan 13 2017, 12:48 AM
Smalyshev changed the task status from Open to Stalled.Jul 12 2017, 9:00 AM

We can abandon query, but we can not really cancel it, since we do not know to which server the query went and have no guarantee cancel query will go to the same server.

If this ticket includes cancelling the query on the server, should we make a new ticket for simply being able to run a new query before the existing one has timed out? It used to be possible before the run button started being disabled, so it seems like making that possible again would be easy to do even if we can't actually cancel the query on the server yet. It would be nice if it could cancel the existing query when starting a new query, but I don't think it really makes a difference to the user.

My concern here is that it will encourage very bad pattern of behavior - running a bad query, seeing it takes long, abandoning it, tweaking, running it again, etc. so that at the end the server ends up with 20 heavy queries running. Yes, I know you could just open a new window or reload, but this is higher barrier to producing lots of heavy queries than just clicking a button.

NoInkling rescinded a token.
NoInkling awarded a token.
NoInkling rescinded a token.
NoInkling awarded a token.
NoInkling added a subscriber: NoInkling.