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

[sql lab] Fix new query stuck at pending state #7523

Merged
merged 1 commit into from
May 16, 2019

Conversation

graceguo-supercat
Copy link

@graceguo-supercat graceguo-supercat commented May 16, 2019

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

I found a very strange corner case: some user didn't use sql lab for a long time, and they didn't have any old query tab in Sql Lab. When recently they started to use sql lab, their async query may stuck at pending state forever. From browser console I can see the query was sent to back end, but browser didn't start polling query results at all. So that even backend finished query, front end is still showing pending state. This issue can't be consistently reproduced, it only happened on few users, but those users are totally blocked and can't run any async queries successfully.

After debug I found polling was stopped by this line:

return (
queriesLastUpdate > 0 &&
Object.values(queries).some(
q => isQueryRunning(q) &&
now - q.startDttm < MAX_QUERY_AGE_TO_POLL,
)
);

For those users got stuck at pending state, when sql lab was initialized, queriesLastUpdate was 0. There was a change for initial value introduced in #5896. queriesLastUpdate was set to 0 before this PR. So i am thinking probably those users' sql lab state was persisted into localStorage. And now they open sql lab with new code base that requires queriesLastUpdate > 0, then their sql lab can't poll anymore.

I don't think queriesLastUpdate > 0 is really necessary for polling query results. So my solution for this issue is just remove this requirement.

TEST PLAN

ci and check with users stuck at pending state.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

REVIEWERS

@williaster @michellethomas

Copy link
Contributor

@williaster williaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cryptic bug 🔍 🐛

Sounds reasonable to me as long as it doesn't keep polling infinitely after it loads 👍

@graceguo-supercat graceguo-supercat merged commit 7f858e4 into apache:master May 16, 2019
michellethomas pushed a commit to michellethomas/panoramix that referenced this pull request May 31, 2019
michellethomas pushed a commit that referenced this pull request Jun 1, 2019
@graceguo-supercat graceguo-supercat deleted the gg-QueryPending branch August 8, 2019 20:38
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 28, 2024
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants