dosubot[bot] commented on issue #34543:
URL: https://github.com/apache/superset/issues/34543#issuecomment-3153246318

   <!-- Answer -->
   This is a known, unresolved issue in Superset 4.1.2 (and master): async 
query cache retrieval fails with multi-parameter Jinja filters (like multiple 
url_param values) in embedded dashboards. The root cause is inconsistent 
serialization of URL parameters between the Celery worker (write phase) and the 
web UI (read phase)โ€”for example, one side may serialize a list as a CSV string, 
while the other expects a list, causing cache key mismatches and 422 errors 
even though the cache key exists in Redis. This is not a Redis or Celery config 
problem, but a bug in how Superset serializes and hashes filter values for 
cache keys in async queries with Jinja templating 
[[1]](https://github.com/apache/superset/issues/31975).
   
   Workarounds like setting `add_to_cache_keys=False` on url_param avoid the 
error but break filtering, since the cache key no longer reflects filter 
values. Disabling `GLOBAL_ASYNC_QUERIES` avoids the bug but sacrifices async 
processing and scalability 
[[2]](https://github.com/apache/superset/issues/31975). Some users have 
reverted a deduplication change in `get_extra_cache_keys` (removing 
`list(set(...))`) as a local patch, but this is not a general solution and may 
have side effects [[3]](https://github.com/apache/superset/issues/31975).
   
   There is no official fix or comprehensive workaround as of August 2025. The 
bug persists in the latest Superset versions. If you need async queries and 
multi-parameter Jinja filters in production, you may need to limit to 
single-parameter filters, avoid async queries, or monitor for upstream fixes. 
For reference, the relevant code paths are: `superset/jinja_context.py` 
(ExtraCache, url_param), `superset/common/query_object.py` 
(QueryObject.cache_key), `superset/common/query_context_processor.py` 
(QueryContextProcessor.query_cache_key), and 
`superset/connectors/sqla/models.py` (get_extra_cache_keys) 
[[4]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/jinja_context.py).
   
   If you want to explore a custom patch, the key is to ensure that URL 
parameters are serialized in a canonical way (e.g., always as a sorted, 
comma-separated string) in both the async job and the web UI before hashing for 
the cache key. Let me know if you want more details on where to apply such a 
patch.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=hallucination)
 | [Report 
๐Ÿ›](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/f9ddff81-d630-49b9-aab2-c7641a79c4d2?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat
 with 
Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=githu
 b)&nbsp;[![Join 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share
 on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/34543)


-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to