You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "apoteet (via GitHub)" <gi...@apache.org> on 2024/11/07 22:05:39 UTC
[I] Race condition in dashboards makes search results not reflect current filters [superset]
apoteet opened a new issue, #30872:
URL: https://github.com/apache/superset/issues/30872
### Bug description
1. Go to a dashboard, ideally featuring a slow table with lots of rows of data
2. Run a search with very broad or no filters that will take a long time
3. As soon as you start the slow search, run a much quicker search, such as by a specific id.
✅ The fast search will return and show up on the page
and then
❌ When the slow search completes, it will clobber the table content with the original search query results, putting you in a state where the data presented does not match the last thing searched.
I think when a new query is run, the old query needs to be cancelled/promise rejected.
### Screenshots/recordings
https://github.com/user-attachments/assets/60eb7431-0b7f-4458-9965-ad0411949b03
### Superset version
4.0.2
### Python version
3.10
### Node version
18 or greater
### Browser
Chrome
### Additional context
We have enabled `EMBEDDED_SUPERSET`, `HORIZONTAL_FILTER_BAR`, and `EMBEDDABLE_CHARTS`, though this video is in the superset app.
The datasource is a redshift table
### 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.
--
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-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "apoteet (via GitHub)" <gi...@apache.org>.
apoteet commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2822433921
On our side, i've already closed this as won't fix. I won't blame you for doing the same 😅
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "apoteet (via GitHub)" <gi...@apache.org>.
apoteet commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2463860421
> That's the joy of it! Nobody does! If you feel like opening a PR, we'd be plenty happy to review it.
I thought my comment would get that response 😅. We'll see if the issue is as big a blocker as someone claimed and go from there.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2463326195
<!-- Answer -->
To address the race condition in Superset dashboards where a slow search query overwrites the results of a faster search, you can implement a debouncing mechanism. This can be done using the `debounce` function from `lodash` to manage the timing of updates. The `publishDataMask` function in Superset already uses this approach to update URL parameters with the current state of the data mask, which is part of the filtering logic.
Here's a snippet of how this is implemented:
```tsx
const publishDataMask = debounce(
async (
history,
dashboardId,
updateKey,
dataMaskSelected: DataMaskStateWithId,
tabId,
) => {
// ... existing logic to update URL parameters
},
SLOW_DEBOUNCE,
);
```
The `SLOW_DEBOUNCE` constant sets the debounce delay, ensuring that only the most recent search query results are applied, preventing older, slower queries from overwriting them. Adjusting the debounce delay can help fine-tune the responsiveness and accuracy of the filter updates <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/nativeFilters/FilterBar/index.tsx)</sup>.
Additionally, Superset's frontend can handle the cancellation of ongoing queries when a new query is initiated by using an `AbortController`. This allows the ongoing query to be aborted if a new query is triggered, ensuring that the most recent query results are displayed <sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/Chart/chartAction.js)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2463768164
> @dosu That would be true in my own application, but I do not own superset's react code.
That's the joy of it! Nobody does! If you feel like opening a PR, we'd be plenty happy to review it.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2822038630
This has been silent for a long time, and I suspect it's an edge case that people just aren't running into much. Can you validate if this is still happening in 4.1.2/5.0.0? It might get closed as inactive/not-planned if we can't find anyone to back it and contribute a fix.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2463356860
<!-- Answer -->
In Superset, handling query cancellations and ensuring that only the latest query results are displayed can be managed using the `AbortController` API. This API is used in Superset's query handling to manage and potentially abort ongoing HTTP requests. It is implemented in the `superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx` file. The `AbortController` is instantiated to create a signal that is passed to the `SupersetClient.get` method, allowing the request to be aborted if necessary <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx)</sup>.
Additionally, the `sqlLabReducer` in `superset-frontend/src/SqlLab/reducers/sqlLab.js` manages the lifecycle of queries, including starting, updating, and canceling them. The `STOP_QUERY` action, for example, sets the state of a query to `Stopped` and clears its results, which can help prevent older queries from overwriting newer results <sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/src/SqlLab/reducers/sqlLab.js)</sup>.
These mechanisms can help address the issue of race conditions in query execution by ensuring that only the most recent query results are displayed.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "apoteet (via GitHub)" <gi...@apache.org>.
apoteet commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2463354465
@dosu That would be true in my own application, but I do not own superset's react code.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30872:
URL: https://github.com/apache/superset/issues/30872#issuecomment-2463768435
<!-- Answer -->
If you're interested in contributing a fix, you can fork the repository and make the necessary changes to handle query cancellations using the `AbortController` API. Once you've implemented and tested your solution, you can open a pull request for review. The community is generally supportive and can provide feedback to help refine your contribution. If you need guidance on setting up the development environment or have questions about the codebase, feel free to ask!
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Race condition in dashboards makes search results not reflect current filters [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #30872: Race condition in dashboards makes search results not reflect current filters
URL: https://github.com/apache/superset/issues/30872
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org