superset icon indicating copy to clipboard operation
superset copied to clipboard

Chart report on a failing chart holds a Celery worker for 56 minutes and delays every other report (7.0.0rc2)

Open bmuraykhi opened this issue 3 weeks ago • 0 comments

Bug description

A PNG or PDF report on a chart whose query fails stays Working for 56 minutes with the default settings, and holds a Celery worker process the whole time. A CSV report on the same chart fails in 0.06 s. A chart's query can start failing for ordinary reasons: a column is renamed or dropped, a table moves, a permission is revoked.

Why this needs fixing

  • Each broken report takes one worker process for the whole wait. Reports, alerts and the reports.scheduler tick all run on those processes, so with the default --concurrency=2 from docker/docker-bootstrap.sh, two broken reports stop all of them. In the run below, a healthy report scheduled for 07:43:00 started at 08:38:30, and its scheduler tick only ran then too.
  • The report's owners find out late: the error email went out when the wait ended, 56 minutes after the run started.
  • It's a regression. On 6.1.0 this wait had no budget (element.wait_for()), so it used the 60 s Playwright default.

How to reproduce

Setup: master with ALERT_REPORTS on, Postgres, Redis, Celery beat, one Celery worker with --concurrency=2, Playwright. I used the published image apache/superset:230d9b0.

  1. Add a dataset on a table sales (region text, amount int).
  2. Create two Big Number charts whose query fails, with the custom SQL metrics SUM(no_such_column) and SUM(dropped_column), and one healthy chart with SUM(amount).
  3. Create a PNG email report on each chart and leave the working timeout at the default 3600 s. Schedule the two broken charts for minute 42 and the healthy chart for minute 43.
  4. Watch each report's execution log.

Result:

Report Scheduled Started Finished Outcome
Broken chart A 07:42:00 07:42:00 08:38:30 Error after 56 min 30 s
Broken chart B 07:42:00 07:42:00 08:38:30 Error after 56 min 30 s
Healthy chart 07:43:00 08:38:30 08:38:39 Success, started 55 min 30 s late
Failed taking a screenshot Locator.wait_for: Timeout 3386030.3101230236ms exceeded.
Call log:
  - waiting for locator(".chart-container") to be visible

To see it without waiting an hour: set a broken chart's report to a working timeout of 300 s and click "Trigger now". It fails with the same error after 90 s (300 s minus the 210 s of reserves).

Expected: the report finishes in seconds. #44465 settled that "visible query-error panels remain capture-ready and may be delivered with diagnostic warnings if the image passes visual validation", and dashboard reports already do that.

Cause: for a chart report, WebDriverPlaywright.get_screenshot first waits for .chart-container, and since #42624 that wait gets whatever is left of the execution budget minus the reserves. Chart.tsx renders the loading and success states inside .chart-container, but the failed state in a bare ErrorContainer, so the element never appears. CHART_CONTAINER_READY_JS already treats an error as a terminal state, but only inside .chart-container. Giving that container the class lets the existing waits and checks capture the error, and I have a PR ready that does this.

Screenshots/recordings

Execution log of a report on a broken chart: 56 min 30 s, then the .chart-container timeout:

Image

Execution log of the healthy report: scheduled for 07:43:00, started at 08:38:30:

Image

Superset version

master / latest-dev

Python version

3.11

Node version

Not applicable

Browser

Not applicable

Additional context

  • Reproduced on master at 230d9b0157. No commit since has touched Chart.tsx, webdriver.py or screenshot_utils.py, as of 2645396b7a. Also reproduced on 7.0.0rc2, where a 300 s working timeout fails after 90 s the same way.
  • Worker log for the same run: Timed out requesting url http://.../explore/?form_data=%7B%22slice_id%22%3A%202%7D&force=false&standalone=3, then playwright._impl._errors.TimeoutError: Locator.wait_for: Timeout 3386052.5681650033ms exceeded.
  • Workaround: lower the report's working timeout or ALERT_REPORTS_EXECUTION_BUDGET_SECONDS.
  • Related: #46064 fixes a similar hour-long hold for dashboard tabs without charts. This one is chart reports.
  • cc @fitzee @eschutho (#42624)

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.

bmuraykhi avatar Nov 08 '26 09:11 bmuraykhi