superset icon indicating copy to clipboard operation
superset copied to clipboard

Long queries run successfully but aren't displaying any results

Open nikitathampi opened this issue 9 years ago • 12 comments

Make sure these boxes are checked before submitting your issue - thank you!

  • [x] I have checked the superset logs for python stacktraces and included it here as text if 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

Superset version

0.20.4

Expected results

Some of my queries in SQL Lab would time out after the 30 second limit set in the config.py file so I changed the SQLLAB_TIMEOUT = 30 line in config.py to timeout at 300 seconds so I could work with these queries.

Actual results

The status of the query changes to "success" after running for about 2 minutes, but it doesn't actually display any results.

While the query is still running, the logs display 2017-11-16 11:35:53,904:INFO:root:[stats_logger] (incr) queries every second or so.

When the status of the query changes from 'running' to 'success', the logs look like this

2017-11-16 11:35:48,801:INFO:root:Fetching cursor description
2017-11-16 11:35:49,904:INFO:root:[stats_logger] (incr) queries
2017-11-16 11:35:51,467:INFO:root:[stats_logger] (incr) queries
2017-11-16 11:35:51,907:INFO:root:[stats_logger] (incr) queries

After a few minutes of this, it displayed this message:

query in models.py
{'extras': {'druid_time_origin': '',
            'having': '',
            'having_druid': [],
            'time_grain_sqla': 'hour',
            'where': ''},
 'filter': [{'col': 'a', 'op': 'in', 'val': []},
            {'col': 'b', 'op': 'in', 'val': ['yes']}],
 'form_data': {'annotation_layers': [],
               'color_scheme': 'googleCategory20c',
               'datasource': '32__table',
               'filters': [{'col': 'a', 'op': 'in', 'val': []},
                           {'col': 'b', 'op': 'in', 'val': ['yes']}],
               'granularity_sqla': 'date',
               'having': '',
               'metric': 'count_distinct__x',
               'metric_2': 'sum__y',
               'since': '100 years ago',
               'slice_id': 77,
               'time_grain_sqla': 'hour',
               'until': 'now',
               'viz_type': 'dual_line',
               'where': '',
               'x_axis_format': 'smart_date',
               'y_axis_2_format': '$,.2f',
               'y_axis_format': '.3s'},
 'from_dttm': datetime.datetime(1917, 11, 16, 0, 0),
 'granularity': 'date_created',
 'groupby': [],
 'is_timeseries': True,
 'metrics': ['count_distinct__x', 'sum__y'],
 'order_desc': True,
 'row_limit': 50000,
 'timeseries_limit': 0,
 'timeseries_limit_metric': None,
 'to_dttm': datetime.datetime(2017, 11, 16, 11, 44, 52)}

<-----

2017-11-16 11:44:53,565:INFO:root:Caching for the next 86400 seconds
2017-11-16 11:44:53,615:INFO:root:Caching for the next 86400 seconds
2017-11-16 11:44:53,641:INFO:root:[stats_logger] (incr) queries
2017-11-16 11:44:53,663:INFO:root:[stats_logger] (incr) queries
2017-11-16 11:44:53,684:INFO:root:[stats_logger] (incr) queries
2017-11-16 11:44:53,704:INFO:root:[stats_logger] (incr) queries
2017-11-16 11:44:53,724:INFO:root:[stats_logger] (incr) queries

Steps to reproduce

Edit the config.py file. Change this line - SQLLAB_TIMEOUT = 30 to SQLLAB_TIMEOUT = 300

Run a query that takes over 30 seconds.

nikitathampi avatar Nov 16 '17 16:11 nikitathampi

I have the apparently the same issue, however I didn't change SQLLAB_TIMEOUT -- I think it doesn't make sense to open a separate issue, but it's worth noting that non-default configuration is not a required as a repro condition.

I do:

  • run a long query (> 30s)
  • in the browser's console i see /sql_json request being closed after 30s (abruptly; i don't see any response)
    • browser's console shows the below:
      Uncaught TypeError: Cannot read property 'indexOf' of undefined
          at Object.n [as error] (sqllab.6554f1029fea6108ef2b.entry.js:102)
          at l (sqllab.6554f1029fea6108ef2b.entry.js:34)
          at Object.fireWith [as rejectWith] (sqllab.6554f1029fea6108ef2b.entry.js:34)
          at S (sqllab.6554f1029fea6108ef2b.entry.js:34)
          at XMLHttpRequest.<anonymous> (sqllab.6554f1029fea6108ef2b.entry.js:34)
      
  • .. but the UI still shows "loading" (loading.gif) and shows progress bar (however, even though UI polls for progress updates, there are no progress updates even after the query is finished in Presto)

image

findepi avatar May 03 '18 13:05 findepi

Is the DB in async mode or not? Note that some issues in this area can be related to a proxy or load balancer timing out before Superset does. You want to set your timeouts to be shorter than the proxy's timeout so that Superset can handle the error properly.

mistercrunch avatar May 03 '18 15:05 mistercrunch

@mistercrunch in my case:

  • query is in sync mode
  • there is no load balancer, superset is running locally in a docker container
  • superset is served with env GUNICORN_CMD_ARGS="--bind 0.0.0.0:8088 --limit-request-field_size 0 --limit-request-line 0 --timeout 120 --worker-class gevent --workers 4" gunicorn superset:app (but the tripping point is 30s)

findepi avatar May 03 '18 19:05 findepi

I haven't dug it, but we really shouldn't poll for database in sync mode. It must be some race condition between the state handling on the callback and the one from the polling. It could also have something to do with timestamps/timezones around the polling.

In theory the polling should just confirm the state reported by the async javascript call, but somehow it isn't.

The way to debug is to install the redux browser plugin and look into what's up in the "time traveling debugger"

mistercrunch avatar May 04 '18 00:05 mistercrunch

I experience the same as @findepi in an async mode. The UI keeps polling the server for response even after timeout. What helps is to set SQLLAB_TIMEOUT to a bigger value. I'll try to investigate.

dmigo avatar Jun 26 '18 10:06 dmigo

We also experience the as as @findepi and @dmigo, more interesting is, as long as we open the SQLLab page, even before any query been issues, browser starts to polling status from server side.

@dmigo do you have any finds regarding setting SQLLab_TIMEOUT to a bigger value?

xqliu avatar Jun 30 '18 12:06 xqliu

@xqliu it appears to be a front-end problem, as it keeps polling the server even after the timeout. Unfortunately I didn't have enough time to investigate the problem.

dmigo avatar Jul 02 '18 07:07 dmigo

Hello friends, do you have any update on this? I'm having the same issue. Also increasing the SQLLAB_TIMEOUT to a bigger value (at the moment is set to 600) doens't solve the problem. Thanks

dichiarafrancesco avatar Nov 06 '18 17:11 dichiarafrancesco

This issue is real old and a at this point it's a mixed bag of different symptoms. I'm closing it and encouraging people that still have the issue on a recent version to open a new one and do a full report of what is happening.

mistercrunch avatar Nov 08 '18 06:11 mistercrunch

That's fine. I just found out it was an internal problem not related to superset.

dichiarafrancesco avatar Nov 08 '18 17:11 dichiarafrancesco

@dichiarafrancesco i'm facing almost the same issue. can you please let me know how did you resolve it?

deepak-goel avatar Jan 17 '19 11:01 deepak-goel

I got this working as well.

Most of our queries were being successfully executed by superset, but all the queries with CASE statement were being thought as a "threat" by our firewall. After making the necessary changes in our firewall, those queries also started working fine.

deepak-goel avatar Jan 17 '19 23:01 deepak-goel