Bug description
When I visiting Home and Charts page, I can see thumbnails correctly, but when I visit Dashboard page I can't see thumbnails. I configured S3 caching for thumbnails like below in superset_config.py:
def init_thumbnail_cache(app, config, cache_args, cache_options) -> S3Cache:
return S3Cache("superset-result-backend-cache", 'thumbnails/')
THUMBNAIL_CACHE_CONFIG = {'CACHE_TYPE': 'superset_config.init_thumbnail_cache'}
THUMBNAIL_SELENIUM_USER = get_env("THUMBNAIL_SELENIUM_USER", default="Admin")
THUMBNAIL_EXECUTE_AS = [ExecutorType.SELENIUM]
At the behind, I am seeing logs like below:
2024-09-16 14:45:23,017:WARNING:superset.common.utils.query_cache_manager:force_cached (QueryContext): value not found for key 9e7535a0f4d4bd1307c7e630a3756c0e
2024-09-16 14:48:42,882:INFO:superset.utils.screenshots:Attempting to get from cache: aa065c951be3dedba518d13eac81976d
2024-09-16 14:48:42,893:INFO:superset.utils.screenshots:Attempting to get from cache: 318a398cd116f164114f22aca987c5e9
2024-09-16 14:48:43,262:INFO:superset.utils.screenshots:Attempting to get from cache: 96feaa217625a1c02d3c42b62841287b
/home/superset/superset/venv/lib/python3.11/site-packages/_distutils_hack/__init__.py:31: UserWarning: Setuptools is replacing distutils. Support for replacing an already imported distutils is deprecated. In the future, this condition will fail. Register concerns at https://github.com/pypa/setuptools/issues/new?template=distutils-deprecation.yml
warnings.warn(
2024-09-16 14:48:44,990:ERROR:superset.utils.json:JSON is not valid Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/home/superset/superset/venv/lib/python3.11/site-packages/superset/utils/json.py", line 244, in loads
return simplejson.loads(
^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2024-09-16 14:48:45,108:ERROR:superset.utils.json:JSON is not valid Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/home/superset/superset/venv/lib/python3.11/site-packages/superset/utils/json.py", line 244, in loads
return simplejson.loads(
^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
2024-09-16 14:48:45,244:ERROR:superset.utils.json:JSON is not valid Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/home/superset/superset/venv/lib/python3.11/site-packages/superset/utils/json.py", line 244, in loads
return simplejson.loads(
^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/__init__.py", line 514, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 386, in decode
obj, end = self.raw_decode(s)
^^^^^^^^^^^^^^^^^^
File "/home/superset/superset/venv/lib/python3.11/site-packages/simplejson/decoder.py", line 416, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
How to reproduce the bug
- Go to Dashboard page
- Check thumbnails on page
Screenshots/recordings
Superset version
master / latest-dev
Python version
3.11
Node version
16
Browser
Chrome
Additional context
I am using Apache Superset 4.1.0rc2 version :)
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.
Comment From: dosubot[bot]
@mpolatcan Hello! I'm here to help you with any bugs, questions, or contributions.
I found some similar issues that might help you:
- [Question] Are dashboard thumbnails generated periodically? (Closed)
- Solution: The issue was closed as stale. If the problem persists in current versions, it was suggested to reopen the issue or raise a new one with updated context.
-
[chart] "Unexpected error" in Dashboard thumbnails (Superset 1.0.1) (Closed)
- Solution: Adding "can read on Chart" permission resolved the issue.
-
Why does only the thumbnail function in the chart work? The dashboard does not appear. (Closed)
- Solution: A regression on the master branch caused dashboard thumbnails to fail, which was fixed by a specific pull request.
- Link to issue [3]
Regarding your specific issue, the problem might be related to the caching logic for the Dashboard thumbnails. Ensure that the cache_dashboard_thumbnail
function is being triggered correctly and that the thumbnail_cache
is properly configured and accessible. Check the logs for any warnings or errors related to the caching process, as indicated by the logging statements in the code:
if not thumbnail_cache:
logging.warning("No cache set, refusing to compute")
return
If the cache is not set, the function will refuse to compute the thumbnail, which could explain why the thumbnails are not appearing on the Dashboard page [4].
Additionally, there are specific differences in how the Home, Chart, and Dashboard pages handle thumbnail caching and retrieval. The DashboardScreenshot
class has specific configurations for handling thumbnails, including different default window and thumbnail sizes, URL modifications, and cache key parameters [5][6][7][4][8].
Ensure that your S3 cache is correctly configured and accessible, and verify that the cache_dashboard_thumbnail
function is being called as expected.
To continue talking to Dosu, mention @dosu.
Comment From: rusackas
Assigning to @geido , but also CC-ing @yousoph / @kasiazjc - not sure how long this has gone unreported, but that makes me wonder about the utility/discoverability of the thumbnail views.
Comment From: iercan
We are facing the same issue on 4.1.1 despite using Redis cache.
Comment From: ryepezb1
Alguien pudo solucionar el problema??? sigo sin poder solucionarlo
Comment From: JustGui
Using version 5.0.0rc1 with Redis for cache, Firefox & Playwright to generate screenshots, we also can see the screenshots in tabs Home & Charts but nothing on the tab Dashboards Looking at the network console I can see that the thumbnails are just not called by the interface on the tab Dashboards, when they are called for the tabs Home & Charts
Comment From: pang-wu
+1 here, on 5.0.0rc1 thumbnails are just not called by the interface on the tab Dashboards
Comment From: pellepelle3
+1
Comment From: romankevich
+1 4.1.2
Comment From: rad-pat
This seems to have been since https://github.com/apache/superset/pull/28609.
Adding the thumbnail_url
into the list of columns retrieved seems to fix the issue in my local build, though I don't understand the PR comment wrt thumbnail_url
@dpgaspar
Comment From: rad-pat
OK, I get it now. Calculating the digest can take some time for lots of dashboards. Anyway it somehow seems that, since that change, a request is made to each dashboard by id to get the thumbnail_url, but the setThumbnailUrl
doesn't appear to request the thumbnail blob.