Bug description
Describe the bug This issue occurs specifically with the /dataset method. It does not consistently return the correct dataset when called concurrently with Rison encoded filter looking for the "table_name". The problem manifests about 5% of the time, indicating it may be a race condition or a resource contention issue.
To Reproduce 1. Make multiple parallel API requests to the /dataset endpoint, each querying for different "table_name" values. 2. Compare the returned datasets with the expected results based on the initial queries.
What I've tried: - When the error occurs, a subsequent call with the same query returns the correct dataset, suggesting that the issue may not be with the dataset itself but rather with how the API handles concurrent requests. - Serial calls (one after the other) do not produce errors, indicating that the problem is likely related to concurrency. - Using 'mitmweb' to monitor traffic revealed that the error originates from the Superset response.
Screenshots/recordings
N.A.
Superset version
v5.0.0rc3 v4.1.2
Python version
3.9
Node version
22
Browser
Chrome
Additional context
I'm developing an application that generates dashboards "on the fly" where each chart is basically fed by a dataset (in a 1:1 relationship). Since the dataset's table_name is a unique ID, I'm using it to retrieve the dataset through the API, giving it a fixed UUID based on the user/dashboard.
I am making approximately 12 concurrent requests to retrieve around 70 datasets, which are updated frequently.
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] 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.
Comment From: orlandolaycos
I've created a small example in Python, separate from my main project code. Forgive the informality, there are several additional tests to verify that we are properly "connected" to the API. The case we're interested in is the "extress_dataset_api" function.
Comment From: LisaHusband
I fixed the bug in the sample code you provided and published it to this repository