Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queries are not stopping via superset SQL Lab #31814

Open
3 tasks done
talh3747 opened this issue Jan 13, 2025 · 1 comment
Open
3 tasks done

Queries are not stopping via superset SQL Lab #31814

talh3747 opened this issue Jan 13, 2025 · 1 comment
Labels
data:connect:trino Related to Trino sqllab Namespace | Anything related to the SQL Lab

Comments

@talh3747
Copy link

Bug description

When a SQL query is running is SQL Lab, it can't be stopped error received is "Failed at stopping query."

How to reproduce the bug

  1. Go to the SQL Lab.
  2. Write and run a query.
  3. Click on the STOP button.
  4. Expect to see error "Failed at stopping query."

Expected results
Query should stop running.

Actual results
Query is still runing, unless I kill it from the Trino itself, and failed at stopping query message poppes up.

Screenshots/recordings

No response

Superset version

4.1.1

Python version

3.10

Node version

I don't know

Browser

Chrome

Additional context

I am trying to upgrade my current superset cluster from superset 0.0.0-dev to superste 4.1.1, using the official helm-chart, and official superset images. I have a master, celery worker, redis as broker and postgres as my metadata backend.

My db engine is Trino and when I try to stop queries all I see is the "Failed at stopping query" error and in the master logs I see the /api/v1/query/stop request is always receiving 422 (unprocessable entity).
Also, in the worker logs I don't see that he receives tasks and also no additional logs in the redis instance itself, but they are connected.

When I lookup in the dev tools I see in the stop event this message - "Could not cancel query".

I also tries to use the api myself and stop the query with post request with the generated 'client_id' and the right headers and I got 400 over and over again.
Also in the master logs I see that when the query is submitted it says in the logs : "Running query on a celery worker" but again no logs in the worker.

When I deleted the worker deployment and used only the master, the query did stop properly.

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added data:connect:trino Related to Trino sqllab Namespace | Anything related to the SQL Lab labels Jan 13, 2025
Copy link

dosubot bot commented Jan 13, 2025

Hey there, @talh3747! I'm here to help you with your Superset issue. I can assist with bug fixes, answer your questions, and guide you on becoming a contributor. Let's dive in and tackle this challenge together!

The issue you're experiencing with query cancellation in Superset's SQL Lab when using Trino as the database engine could be related to several factors. Here are some potential areas to investigate:

  1. Celery Worker Configuration: Ensure that your Celery workers are correctly configured to receive and execute tasks. The CELERY_CONFIG in your superset_config.py should be properly set up, and the Celery worker should be started with the correct command. Verify that the broker URL and result backend are correctly configured and that the necessary imports are included [1].

  2. Query Cancellation Mechanism: Superset uses a cancel_query_id stored in the query's extra JSON payload to identify and cancel queries. Ensure that this ID is being correctly set and retrieved. The client_id is crucial for identifying the query session for cancellation [2][3].

  3. Trino-Specific Settings: Check the settings related to Trino in Superset, such as the QUERY_CANCEL_KEY and QUERY_EARLY_CANCEL_KEY. These are used to manage query cancellation and should be correctly implemented [2].

  4. Error Handling: The 422 (unprocessable entity) error suggests that there might be an issue with the request payload or the way the query cancellation is being handled. Double-check the API request format and ensure that all required parameters are correctly specified.

  5. Logs and Debugging: Since you mentioned that the worker logs do not show task reception, ensure that the Celery worker is running and connected to the broker. Check the logs for any errors or warnings that might indicate connectivity or configuration issues.

  6. Database Engine Support: Ensure that Trino supports the query cancellation features being used. If the cancellation key is not set or if the database engine does not support explicit cancellation, the query cannot be stopped [4].

By addressing these areas, you should be able to identify and resolve the issue with query cancellation in Superset.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:connect:trino Related to Trino sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

No branches or pull requests

1 participant