apache / superset

Apache Superset is a Data Visualization and Data Exploration Platform
https://superset.apache.org/
Apache License 2.0
62.54k stars 13.77k forks source link

Dashboard without a chart fails when generating thumbnail at screenshot step by celery worker #25237

Open Jkraft7 opened 1 year ago

Jkraft7 commented 1 year ago

In our superset instance we use celery workers to get thumbnails. We run into an issue where if there is an empty/blank dashboard that exists. It causes selenium errors to continually occur whenever the thumbnail is attempted to be created in the celery worker which leads to massive cpu usage and blockers for other things (such as reports/alerts)

It states selenium is timing out while trying to run the get_screenshot function. the error itself is:

Selenium timed out requesting url http://localhost:8080/superset/dashboard/260/?standalone=3
Traceback (most recent call last):                                                                                                                                                                                                                                          │
│   File "/app/superset/utils/webdriver.py", line 187, in get_screenshot                                                                                                                                                                                                      │
│     WebDriverWait(driver, self._screenshot_load_wait).until(                                                                                                                                                                                                            │
│   File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/support/wait.py", line 80, in until                                                                                                                                                                   │
│     raise TimeoutException(message, screen, stacktrace)                                                                                                                                                                                                                                         │
│ selenium.common.exceptions.TimeoutException: Message:  

This error began occurring after the upgrade from 2.0.0 to 2.1.0. This can be detrimental to a celery worker as if there are not enough threads plus the users generate multiple blank/empty dashboards this can block all other activity in the celery worker.

From my perspective it is exactly related to this: https://github.com/apache/superset/issues/17245 except this is when we try to generate a thumbnail and not a report. These two functionalities should be running roughly the same logic i believe. As a note on that i can also replicate the above issue in my environment as well.

How to reproduce the bug

  1. Ensure you have thumbnails enabled and are using a celery worker to generate them
  2. Create a dashboard with no charts
  3. Navigate to the Dashboards page
  4. Then check celery/k9s logs of it attempting to generate the thumbnail and you will see this error above occurring for the dashboards without the charts.

Expected results

Expect that the dashboard will just generate a blank screenshot or have some form of a default method to handle empty dashboards instead of throwing an error consistently.

Actual results

Error is thrown every time selenium attempts to screenshot the dashboard for the thumbnail

Screenshots

Screenshot 2023-09-05 at 4 25 39 PM

Environment

(please complete the following information):

Make sure to follow these steps before submitting your issue - thank you!

Additional context

Add any other context about the problem here.

zhaorui2022 commented 1 year ago

We also noticed the same issue while testing 3.0.0 version.

rusackas commented 7 months ago

Thanks for confirming this was happening in 3.0.0. Is it still in 3.1.x or 4.0? I assume so, but it's been quite a while since nay updates happened here, so I want to make sure this still valid before it becomes at risk of being closed as stale. ALso have you tried the PLAYWRIGHT_REPORTS_AND_THUMBNAILS flag?

amolsr commented 6 months ago

Hi, we are facing similar issue. caching the dashboard before the report is generated should help in these type of scenario.