Skip to content

fix(sqllab): async queries no longer stuck at Running forever - #42896

Draft
sadpandajoe wants to merge 1 commit into
masterfrom
fix-sqllab-async-query-stuck-running
Draft

fix(sqllab): async queries no longer stuck at Running forever#42896
sadpandajoe wants to merge 1 commit into
masterfrom
fix-sqllab-async-query-stuck-running

Conversation

@sadpandajoe

Copy link
Copy Markdown
Member

fix(sqllab): async queries no longer stuck at Running forever

SUMMARY

REFRESH_QUERIES's stale-poll guard in the SQL Lab reducer discarded any
incoming Success update whenever the locally stored query state was
Running, Fetching, or Success. Guarding Fetching/Success makes
sense (a late-arriving poll response shouldn't clobber a state that's
already at or past Success), but Running is strictly before
Success in the query lifecycle, so an incoming Success while local
state is Running is genuine new information, not a stale duplicate.

For async-mode queries (databases with allow_run_async enabled), the
periodic background poller (QueryAutoRefresh dispatching
REFRESH_QUERIES) is the only mechanism that ever updates their state
client-side — runQuery only dispatches querySuccess directly for the
synchronous case. Once such a query was observed in Running, it could
never reach Success: every subsequent poll re-applied the same guard
against the same locally-stuck prevState, so the query appeared
permanently "running" in the UI (e.g. the SQL Lab Query History pane)
even though it had long since finished on the backend.

This drops Running from the blocked-state list so a genuine
Running -> Success transition is no longer discarded, while keeping the
Fetching/Success guard intact for its original purpose.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A. Behavior-only SQL Lab reducer fix (async query status polling); no
visual/layout change.

TESTING INSTRUCTIONS

  1. Run a query against a database with allow_run_async enabled.
  2. Confirm the query correctly transitions from "Running" to "Success" in
    the UI (e.g. Query History) once the backend job completes, instead of
    remaining stuck at "Running" indefinitely.

Automated/local checks run:

  • npx jest src/SqlLab/reducers/sqlLab.test.ts (new + existing tests, 39/39 pass)
  • npx jest src/SqlLab/ (full directory, 45 suites / 423 passed, 1 pre-existing skip)
  • npx oxlint --config oxlint.json --quiet on changed files (clean)
  • npx oxfmt --check on changed files (clean)

ADDITIONAL INFORMATION

  • Has associated issue
  • Required feature flags: SQLLAB_BACKEND_PERSISTENCE is not required;
    reproduction requires a database with allow_run_async enabled
  • Changes UI
  • Includes DB Migration
  • Introduces new feature or API
  • Removes existing feature or API

REFRESH_QUERIES's stale-poll guard blocked any incoming Success update
whenever the locally stored state was Running, Fetching, or Success.
Fetching/Success make sense to guard (a late poll shouldn't clobber a
state that's already at or past Success), but Running is strictly
before Success, so an incoming Success there is genuine new
information, not staleness.

For async-mode queries (allow_run_async databases), this poller
(QueryAutoRefresh, via REFRESH_QUERIES) is the only path that ever
updates their state - runQuery only dispatches querySuccess directly
for the synchronous case. Once such a query was observed Running, it
could never reach Success: every subsequent poll re-applied the same
guard against the same stuck prevState.

Drop Running from the blocked-state list so a genuine Running ->
Success transition is no longer discarded.
@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.38%. Comparing base (91b1a6c) to head (2f88576).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42896   +/-   ##
=======================================
  Coverage   66.38%   66.38%           
=======================================
  Files        2857     2857           
  Lines      161133   161133           
  Branches    37064    37064           
=======================================
+ Hits       106967   106968    +1     
+ Misses      52147    52146    -1     
  Partials     2019     2019           
Flag Coverage Δ
javascript 73.19% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sadpandajoe sadpandajoe added the 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR label Aug 7, 2026
@github-actions github-actions Bot added 🎪 2f88576 🚦 building 🎪 2f88576 🤡 sadpandajoe Environment 2f88576 requested by sadpandajoe 🎪 ⌛ 48h Environment expires after 48 hours (default) and removed 🎪 ⚡ showtime-trigger-start Create new ephemeral environment for this PR labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎪 Showtime is building environment on GHA for 2f88576

@github-actions github-actions Bot added 🎪 2f88576 🚦 deploying 🎪 2f88576 🚦 running Environment 2f88576 status: running 🎪 2f88576 🌐 54.244.83.173:8080 Environment 2f88576 URL: http://54.244.83.173:8080 (click to visit) 🎪 2f88576 📅 2026-08-07T21-48 Environment 2f88576 created at 2026-08-07T21-48 and removed 🎪 2f88576 🚦 building 🎪 2f88576 🚦 running Environment 2f88576 status: running labels Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🎪 Showtime deployed environment on GHA for 2f88576

Environment: http://54.244.83.173:8080 (admin/admin)
Lifetime: 48h auto-cleanup
Updates: New commits create fresh environments automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M 🎪 2f88576 🚦 running Environment 2f88576 status: running 🎪 2f88576 🤡 sadpandajoe Environment 2f88576 requested by sadpandajoe 🎪 2f88576 🌐 54.244.83.173:8080 Environment 2f88576 URL: http://54.244.83.173:8080 (click to visit) 🎪 2f88576 📅 2026-08-07T21-48 Environment 2f88576 created at 2026-08-07T21-48 🎪 ⌛ 48h Environment expires after 48 hours (default)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant