[druid-user] Druid doesn't cancel the query request explicitly

Hello Good day!!

Please help me…

In my usecase I am using Druid data on Dasboard with UI cancel option, so that user can cancel the request explicitly and run the next query.

I was testing the way mentioned on the Druid doc Druid SQL API · Apache Druid

Long running POST request:
curl --request POST ‘https://ROUTER:8888/druid/v2/sql’ \ –header ‘Content-Type: application/json’ \ –data-raw ‘{“query” : “SELECT COUNT(*) MyDataSource”, “context” : {“sqlQueryId” : “myQuery01”}}’

Cancel Request:
curl --request DELETE ‘https://ROUTER:8888/druid/v2/sql/myQuery01

I was expecting as soon I run the run Cancel curl request then long running request should be interupted. But nothing happening.
Cancel request always return 404 http status, I was expecting 202 as per the doc:

curl --request DELETE ‘https://ROUTER:8888/druid/v2/myQuery01 → always return 202.

(Removed /sql from the URL)

Any help much appreciated.
Thanks in advance.


Which version of Druid are you using? That sounds like it might be a bug.

Could you please verify that the query is still being executed when you run the delete API? If the query finishes by the time Druid received the cancel/delete request, you would see the 404 error. Maybe try to cancel a query that’s fetching a huge amount of data, so it would take more time to execute, and meanwhile you could run the HTTP cancel request?



Thank you Mark for your quick reply.

Druid Version :0.22.1

I am 100% sure query was running while executing cancel/delete request. To be more precise I have added timeout 60 seconds also in the query context and run cancel/delete request many times before 60 seconds.

Long running POST request:
curl --request POST ‘https://ROUTER:8888/druid/v2/sql’ \ –header ‘Content-Type: application/json’ \ –data-raw ‘{“query” : “SELECT COUNT(*) from MyDataSource”, “context” : {“sqlQueryId” : “myQuery01”, “timeout”: 60000}}}’

Finally long running request query timeout happend and I got:

“error”: “Query timeout”,
“errorMessage”: “Query [cacb33d5-f575-44c0-8672-de364e827382] timed out!”,
“errorClass”: “org.apache.druid.query.QueryTimeoutException”,
“host”: “”

Cancel request always returning 404.

Thank you for the verification. That sounds like a bug. Are you interested in opening an issue?

Thank you mark.
I had opened and closed issue Druid doesn't cancel the query request explicitly · Issue #13284 · apache/druid · GitHub.

SQL query cancel was added in the Druid version 0.23.0. Tested and working fine in version 24.0 for SQL Query and native Query