spyoungtech opened a new issue, #25600:
URL: https://github.com/apache/superset/issues/25600

   Superset allows you to set cache timeout to `0` and, when configured with 
Redis, this results in the following error:
   
   ```
   redis.exceptions.ResponseError: invalid expire time in 'setex' command
   ```
   
   <details>
   <summary>Full traceback</summary>
   
   ```
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.9/site-packages/ddtrace/contrib/trace_utils_redis.py", 
line 116, in _trace_redis_cmd
       yield span
     File 
"/usr/local/lib/python3.9/site-packages/ddtrace/contrib/redis/patch.py", line 
131, in _traced_execute_command
       return _run_redis_command(span=span, func=func, args=args, kwargs=kwargs)
     File 
"/usr/local/lib/python3.9/site-packages/ddtrace/contrib/trace_utils_redis.py", 
line 82, in _run_redis_command
       result = func(*args, **kwargs)
     File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 1258, 
in execute_command
       return conn.retry.call_with_retry(
     File "/usr/local/lib/python3.9/site-packages/redis/retry.py", line 46, in 
call_with_retry
       return do()
     File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 1259, 
in <lambda>
       lambda: self._send_command_parse_response(
     File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 1235, 
in _send_command_parse_response
       return self.parse_response(conn, command_name, **options)
     File "/usr/local/lib/python3.9/site-packages/redis/client.py", line 1275, 
in parse_response
       response = connection.read_response()
     File "/usr/local/lib/python3.9/site-packages/redis/connection.py", line 
882, in read_response
       raise response
   
   redis.exceptions.ResponseError: invalid expire time in 'setex' command
   ```
   
   </details>
   
   #### How to reproduce the bug
   
   1. Configure superset with a redis broker backend
   2. Configure the database connection's "Schema Cache Timeout" to be `0`  
(Database connections -> `your DB` -> Edit -> Advanced)
   3. Go to SQL Labs and try to make a query to this dataset.
   4. Observe that a call to `api/v1/database/<db pk>/schemas/` returns a `500` 
error and that the above `redis.exceptions.ResponseError` exception is raised 
in server logs
   
   ### Expected results
   
   Setting the cache timeout to `0` should never cause a `setex` command to be 
sent to redis with the timeout value of `0` -- as `setex` always requires a 
positive value.
   
   The invalid value should either (1) be prevented from being set OR (2) be 
treated the same as being _unset_ when the value is `0`.
   
   ### Actual results
   
   The invalid configuration is allowed and causes `setex` to be called with an 
invalid value of `0` an error.
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version: firefox, latest
   - superset version: latest 2.x
   - python version: 3.9 (from docker image)
   - node.js version: `node -v`
   - any feature flags active: no
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version 
of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   Although this is kind of an operator error, I feel that superset should try 
to prevent this kind of user misconfiguration and will lead to a better 
experience for users.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to