dosubot[bot] commented on issue #38564: URL: https://github.com/apache/superset/issues/38564#issuecomment-4033472731
<!-- Answer --> This is a known bug in Superset v6 where `query_timeout` is accessed at [module level in async_queries.py (lines 44-46)](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/tasks/async_queries.py#L44-L46): ```python query_timeout = current_app.config[ "SQLLAB_ASYNC_TIME_LIMIT_SEC" ] ``` When Celery imports this module at startup, there's no active Flask application context, causing the `RuntimeError`. This was identified as a systemic issue in [PR #34345](https://github.com/apache/superset/pull/34345) and has been reported in [#36892](https://github.com/apache/superset/issues/36892). The fix involves moving configuration access from module scope into functions where app context is guaranteed. **Workaround options:** 1. Use Superset v5.0.0 instead, as [v6 has multiple production-readiness issues](https://github.com/apache/superset/issues/37075) 2. Patch the file locally to move `query_timeout` access inside the task functions that need it <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/1ad48554-ae54-438f-9255-e52a864fe877?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/1ad48554-ae54-438f-9255-e52a864fe877?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/1ad48554-ae54-438f-9255-e52a864fe877?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/1ad48554-ae54-438f-9255-e52a864fe877?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1ad48554-ae54 -438f-9255-e52a864fe877?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/1ad48554-ae54-438f-9255-e52a864fe877?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report) | [Other](https://app.dosu.dev/response-feedback/1ad48554-ae54-438f-9255-e52a864fe877?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20bug%20in%20Superset%20v6%20where%20%60query_timeout%60%20is%20accessed%20at%20%5Bmodule%20level%20in%20async_queries.py%20%28lines%2044-46%29%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/tasks/async_queries.py%23L44-L46%29%3A%0A%0A%60%60%60python%0Aquery_timeout%20%3D%20current_app.config%5B%0A%20%20%20%20%22SQLLAB_ASYNC_TIME_LIMIT_SEC%22%0A%5D%0A%60%60%60%0A%0AWhen%20Celery%20imports%20this%20module%20at%20startup%2C%20there%27s%20no%20active%20Flask%20application%20context%2C%20causing%20the%20%60RuntimeError%60.%0A%0AThis%20was%20identified%20as%20a%20systemic%20issue%20in%20%5BPR%20%2334345%5D%2 8https%3A//github.com/apache/superset/pull/34345%29%20and%20has%20been%20reported%20in%20%5B%2336892%5D%28https%3A//github.com/apache/superset/issues/36892%29.%20The%20fix%20involves%20moving%20configuration%20access%20from%20module%20scope%20into%20functions%20where%20app%20context%20is%20guaranteed.%0A%0A%2A%2AWorkaround%20options%3A%2A%2A%0A1.%20Use%20Superset%20v5.0.0%20instead%2C%20as%20%5Bv6%20has%20multiple%20production-readiness%20issues%5D%28https%3A//github.com/apache/superset/issues/37075%29%0A2.%20Patch%20the%20file%20locally%20to%20move%20%60query_timeout%60%20access%20inside%20the%20task%20functions%20that%20need%20it) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20m e%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/38564) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
