apache / superset

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

After upgrade to 4.1.1 Sql Lab does not execute saved queries #31184

Closed mnesarco closed 1 day ago

mnesarco commented 1 day ago

Bug description

  1. Go to saved queries
  2. Edit query (any of them)
  3. Click run

Bum, error

Screenshots/recordings

image

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

dosubot[bot] commented 1 day ago

@mnesarco Hello there! I'm here to help you with any bugs, questions, or contributions you have for Superset. I'm an expert at squashing bugs and providing technical guidance. Let's get to the bottom of this together!

I found a similar closed issue where the problem was identified as a network issue caused by interception of the request. The solution was to modify the firewall configuration, which resolved the issue [1].

If this doesn't apply to your situation, you might want to check the typical error messages or exceptions thrown by SQL Lab when a query execution fails, such as SqlLabException, QueryIsForbiddenToAccessException, or SupersetErrorException [2][3]. These could provide more insight into the specific error you're encountering.

To continue talking to Dosu, mention @dosu.

mnesarco commented 1 day ago

The issue is not related to network issues. Here is some extract o f the error from the log:


superset_app          | INFO:superset.commands.sql_lab.execute:Triggering query_id: 48
superset_app          | INFO:superset.sql_lab:Query 48: Executing 1 statement(s)
superset_app          | INFO:superset.sql_lab:Query 48: Set query to 'running'
superset_app          | INFO:superset.sql_lab:Query 48: Running statement 1 out of 1
superset_app          | INFO:superset.sql_lab:Query 48: Storing results in results backend, key: xxx
superset_app          | WARNING:root:Exception raised while handling cache file '/app/superset_home/sqllab/2029240f6d1128be89ddc32729463129'
superset_app          | Traceback (most recent call last):
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 207, in get
superset_app          |     with self._safe_stream_open(filename, "rb") as f:
superset_app          |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
superset_app          |     return next(self.gen)
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 328, in _safe_stream_open
superset_app          |     fs = self._run_safely(open, path, mode)
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 322, in _run_safely
superset_app          |     output = fn(*args, **kwargs)
superset_app          | PermissionError: [Errno 13] Permission denied: '/app/superset_home/sqllab/2029240f6d1128be89ddc32729463129'
superset_app          | WARNING:root:Exception raised while handling cache file '/app/superset_home/sqllab/2029240f6d1128be89ddc32729463129'
superset_app          | Traceback (most recent call last):
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 207, in get
superset_app          |     with self._safe_stream_open(filename, "rb") as f:
superset_app          |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in __enter__
superset_app          |     return next(self.gen)
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 328, in _safe_stream_open
superset_app          |     fs = self._run_safely(open, path, mode)
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 322, in _run_safely
superset_app          |     output = fn(*args, **kwargs)
superset_app          | PermissionError: [Errno 13] Permission denied: '/app/superset_home/sqllab/2029240f6d1128be89ddc32729463129'
superset_app          | WARNING:root:Exception raised while handling cache file '/app/superset_home/sqllab/162ff78da3a563f9f99605a7d15a433e'
superset_app          | Traceback (most recent call last):
superset_app          |   File "/usr/local/lib/python3.10/site-packages/cachelib/file.py", line 246, in set
superset_app          |     fd, tmp = tempfile.mkstemp(
superset_app          |   File "/usr/local/lib/python3.10/tempfile.py", line 357, in mkstemp
superset_app          |     return _mkstemp_inner(dir, prefix, suffix, flags, output_type)
superset_app          |   File "/usr/local/lib/python3.10/tempfile.py", line 256, in _mkstemp_inner
superset_app          |     fd = _os.open(file, flags, 0o600)
superset_app          | PermissionError: [Errno 13] Permission denied: '/app/superset_home/sqllab/tmpr_cjv83e.__wz_cache'
superset_app          | 192.168.0.1 - - [27/Nov/2024:17:46:11 +0000] "POST /api/v1/sqllab/execute/ HTTP/1.1" 200 11227 "https://xxx/sqllab/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
superset_app          | WARNING:superset.views.error_handling:SupersetErrorException
superset_app          | Traceback (most recent call last):
superset_app          |   File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
superset_app          |     rv = self.dispatch_request()
superset_app          |   File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
superset_app          |     return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
superset_app          |   File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
superset_app          |     return f(self, *args, **kwargs)
superset_app          |   File "/app/superset/views/base_api.py", line 119, in wraps
superset_app          |     duration, response = time_function(f, self, *args, **kwargs)
superset_app          |   File "/app/superset/utils/core.py", line 1364, in time_function
superset_app          |     response = func(*args, **kwargs)
superset_app          |   File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/__init__.py", line 183, in wraps
superset_app          |     return f(self, *args, **kwargs)
superset_app          |   File "/app/superset/utils/log.py", line 303, in wrapper
superset_app          |     value = f(*args, **kwargs)
superset_app          |   File "/app/superset/sqllab/api.py", line 342, in get_results
superset_app          |     result = SqlExecutionResultsCommand(key=key, rows=rows).run()
superset_app          |   File "/app/superset/commands/sql_lab/results.py", line 105, in run
superset_app          |     self.validate()
superset_app          |   File "/app/superset/commands/sql_lab/results.py", line 73, in validate
superset_app          |     raise SupersetErrorException(
superset_app          | superset.exceptions.SupersetErrorException: Data could not be retrieved from the results backend. You need to re-run the original query.
mnesarco commented 1 day ago

It turned out to be a permission problem of sqllab folder onwed by root instead of superset.