MatthewCurlerTAC commented on issue #41862:
URL: https://github.com/apache/superset/issues/41862#issuecomment-4929462122

   I tested the patch by building superset with `SUPERSET_TAG=227b3a4`, 
corresponding to the merge commit into main. Sending a chart as a csv continues 
to generate `HTTP Error 500`. I think this issue needs to be reopened.
   
   ### superset logs
   
   The root error appears to be 
   
   ```
     File "/app/superset/charts/client_processing.py", line 354, in 
apply_client_processing
       StringIO(data),
   TypeError: initial_value must be str or None, not bytes
   ERROR:superset.views.error_handling:initial_value must be str or None, not 
bytes
   ```
   
   Full logs:
   
   ```
   INFO:superset.commands.report.execute_now:Manually executing report schedule 
<report_name> (id: 5), execution_id: de233e3c-c39e-44a1-96d4-4738b7af67f3
   DEBUG:celery.utils.functional:
   def execute(self, report_schedule_id):
       return 1
   
   DEBUG:superset.stats_logger:[stats_logger] (incr) 
ReportScheduleRestApi.execute.success
   DEBUG:superset.stats_logger:[stats_logger] (timing) 
ReportScheduleRestApi.execute.time | 264.1265047714114 
   1.2.3.4 - - [09/Jul/2026:20:38:17 +0000] "POST /api/v1/report/5/execute 
HTTP/1.1" 200 115 
"https://superset.example.com/alert/list/?pageIndex=0&sortColumn=name&sortOrder=desc";
 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0"
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:starrocks.dialect:connect_args: {'host': '100.99.88.77', 'database': 
'default_catalog.dmh', 'user': '<db_user>', 'password': '<db_pass>', 'port': 
9030, 'client_flag': 2}
   WARNING:starrocks.dialect:Failed to get run_mode: 
(pymysql.err.OperationalError) (5203, 'Access denied; you need (at least one 
of) the OPERATE privilege(s) on SYSTEM for this operation. Please ask the admin 
to grant permission(s) or try activating existing roles using <set [default] 
role>. Current role(s): [dmh_ro]. Inactivated role(s): NONE.')
   [SQL: ADMIN SHOW FRONTEND CONFIG LIKE 'run_mode']
   (Background on this error at: https://sqlalche.me/e/14/e3q8)
   DEBUG:starrocks.dialect:system run mode: shared_nothing
   DEBUG:superset.common.query_object:QueryObject CACHE KEY generated: 
1be89de227b363f6f2ec6b7f2a774ba814f0f52f07be862e872d9af7f18b028d from dict with 
keys: ['changed_on', 'columns', 'datasource', 'extra_cache_keys', 'extras', 
'filter', 'granularity', 'group_others_when_limit_reached', 'inner_from_dttm', 
'inner_to_dttm', 'is_rowcount', 'is_timeseries', 'metrics', 'order_desc', 
'orderby', 'post_processing', 'result_type', 'rls', 'row_limit', 'row_offset', 
'series_columns', 'series_limit', 'series_limit_metric', 
'time_compare_full_range', 'time_shift']
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:superset.stats_logger:[stats_logger] (incr) execute_sql
   DEBUG:superset.stats_logger:[stats_logger] (incr) load_into_dataframe
   DEBUG:superset.common.query_object:post_processing: 
    []
   DEBUG:superset.stats_logger:[stats_logger] (incr) QueryObject.post_processing
   DEBUG:superset.stats_logger:[stats_logger] (incr) loaded_from_source
   DEBUG:superset.stats_logger:[stats_logger] (incr) set_cache_key
   DEBUG:superset.utils.cache:CACHE SET - Key: 
1be89de227b363f6f2ec6b7f2a774ba814f0f52f07be862e872d9af7f18b028d, Datasource: 
85__table, Timeout: 10800
   DEBUG:superset.models.core:Database._get_sqla_engine(). Masked URL: 
starrocks://<db_user>:[email protected]:9030/default_catalog.dmh
   DEBUG:superset.stats_logger:[stats_logger] (incr) ChartDataRestApi.data.error
   WARNING:superset.views.error_handling:Exception
   Traceback (most recent call last):
     File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1484, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1469, in 
dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
     File 
"/app/.venv/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py",
 line 128, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/views/base_api.py", line 127, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
     File "/app/superset/utils/core.py", line 1600, in time_function
       response = func(*args, **kwargs)
     File "/app/superset/utils/log.py", line 299, in wrapper
       value = f(*args, add_extra_log_payload=log, **kwargs)
     File "/app/superset/charts/data/api.py", line 353, in data
       return self._get_data_response(
     File "/app/superset/utils/log.py", line 301, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/charts/data/api.py", line 592, in _get_data_response
       return self._send_chart_response(
     File "/app/superset/charts/data/api.py", line 474, in _send_chart_response
       result = apply_client_processing(result, form_data, datasource)
     File "/app/superset/utils/log.py", line 301, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/charts/client_processing.py", line 354, in 
apply_client_processing
       StringIO(data),
   TypeError: initial_value must be str or None, not bytes
   ERROR:superset.views.error_handling:initial_value must be str or None, not 
bytes
   Traceback (most recent call last):
     File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1484, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/app/.venv/lib/python3.10/site-packages/flask/app.py", line 1469, in 
dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
     File 
"/app/.venv/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py",
 line 128, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/views/base_api.py", line 127, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
     File "/app/superset/utils/core.py", line 1600, in time_function
       response = func(*args, **kwargs)
     File "/app/superset/utils/log.py", line 299, in wrapper
       value = f(*args, add_extra_log_payload=log, **kwargs)
     File "/app/superset/charts/data/api.py", line 353, in data
       return self._get_data_response(
     File "/app/superset/utils/log.py", line 301, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/charts/data/api.py", line 592, in _get_data_response
       return self._send_chart_response(
     File "/app/superset/charts/data/api.py", line 474, in _send_chart_response
       result = apply_client_processing(result, form_data, datasource)
     File "/app/superset/utils/log.py", line 301, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/charts/client_processing.py", line 354, in 
apply_client_processing
       StringIO(data),
   TypeError: initial_value must be str or None, not bytes
   172.18.0.5 - - [09/Jul/2026:20:38:20 +0000] "POST /api/v1/chart/data 
HTTP/1.1" 500 243 "-" "Python-urllib/3.10"
   
DEBUG:cron_descriptor.GetText:/app/.venv/lib/python3.10/site-packages/cron_descriptor/locale/en_US.mo
 Loaded
   DEBUG:superset.stats_logger:[stats_logger] (incr) 
ReportScheduleRestApi.get_list.success
   DEBUG:superset.stats_logger:[stats_logger] (timing) 
ReportScheduleRestApi.get_list.time | 74.73946362733841 
   1.2.3.4 - - [09/Jul/2026:20:38:23 +0000] "GET 
/api/v1/report/?q=(filters:!((col:type,opr:eq,value:Alert)),order_column:name,order_direction:desc,page:0,page_size:25)
 HTTP/1.1" 200 770 
"https://superset.example.com/alert/list/?pageIndex=0&sortColumn=name&sortOrder=desc";
 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0"
   DEBUG:superset.stats_logger:[stats_logger] (incr) 
ReportExecutionLogRestApi.get_list.success
   DEBUG:superset.stats_logger:[stats_logger] (timing) 
ReportExecutionLogRestApi.get_list.time | 51.861213985830545 
   1.2.3.4 - - [09/Jul/2026:20:38:26 +0000] "GET 
/api/v1/report/5/log/?q=(order_column:start_dttm,order_direction:desc,page:0,page_size:25)
 HTTP/1.1" 200 1077 
"https://superset.example.com/alert/5/log?pageIndex=0&sortColumn=start_dttm&sortOrder=desc";
 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0"
   DEBUG:superset.stats_logger:[stats_logger] (incr) 
ReportScheduleRestApi.get.success
   DEBUG:superset.stats_logger:[stats_logger] (timing) 
ReportScheduleRestApi.get.time | 102.88260225206614 
   1.2.3.4 - - [09/Jul/2026:20:38:26 +0000] "GET /api/v1/report/5 HTTP/1.1" 200 
1316 
"https://superset.example.com/alert/5/log?pageIndex=0&sortColumn=start_dttm&sortOrder=desc";
 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0"
   DEBUG:superset.stats_logger:[stats_logger] (incr) log
   1.2.3.4 - - [09/Jul/2026:20:38:27 +0000] "POST /log/?explode=events 
HTTP/1.1" 200 1 
"https://superset.example.com/alert/5/log?pageIndex=0&sortColumn=start_dttm&sortOrder=desc";
 "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like 
Gecko) Chrome/150.0.0.0 Safari/537.36 Edg/150.0.0.0"
   DEBUG:superset.stats_logger:[stats_logger] (incr) health
   127.0.0.1 - - [09/Jul/2026:20:38:39 +0000] "GET //health HTTP/1.1" 200 2 "-" 
"curl/7.88.1"
   ```
   
   ### worker logs
   
   These are not particularly useful, but do show the 500 error.
   
   ```
   [2026-07-09 20:38:17,628: INFO/MainProcess] Task 
reports.execute[de233e3c-c39e-44a1-96d4-4738b7af67f3] received
   [2026-07-09 20:38:17,634: INFO/ForkPoolWorker-1] Executing alert/report, 
task id: de233e3c-c39e-44a1-96d4-4738b7af67f3, scheduled_dttm: 
2026-07-09T20:38:17.402165+00:00
   [2026-07-09 20:38:17,638: INFO/ForkPoolWorker-1] session is validated: id 5, 
executionid: de233e3c-c39e-44a1-96d4-4738b7af67f3
   [2026-07-09 20:38:18,516: INFO/ForkPoolWorker-1] Query for 
de233e3c-c39e-44a1-96d4-4738b7af67f3 took 307.95 ms
   [2026-07-09 20:38:20,412: ERROR/ForkPoolWorker-1] CSV generation failed 
after 1.86s - execution_id: de233e3c-c39e-44a1-96d4-4738b7af67f3
   Traceback (most recent call last):
     File "/app/superset/commands/report/execute.py", line 724, in _get_csv_data
       csv_data = self._post_chart_data(
     File "/app/superset/commands/report/execute.py", line 694, in 
_post_chart_data
       urllib.request.build_opener().open(request, timeout=timeout)  # noqa: 
S310
     File "/usr/local/lib/python3.10/urllib/request.py", line 525, in open
       response = meth(req, response)
     File "/usr/local/lib/python3.10/urllib/request.py", line 634, in 
http_response
       response = self.parent.error(
     File "/usr/local/lib/python3.10/urllib/request.py", line 563, in error
       return self._call_chain(*args)
     File "/usr/local/lib/python3.10/urllib/request.py", line 496, in 
_call_chain
       result = func(*args)
     File "/usr/local/lib/python3.10/urllib/request.py", line 643, in 
http_error_default
       raise HTTPError(req.full_url, code, msg, hdrs, fp)
   urllib.error.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR
   [2026-07-09 20:38:20,455: INFO/ForkPoolWorker-1] header_data in 
notifications for alerts and reports {'notification_type': 'Alert', 
'notification_source': <ReportSourceFormat.CHART: 'chart'>, 
'notification_format': 'CSV', 'chart_id': 274, 'dashboard_id': None, 'editors': 
[2], 'slack_channels': [], 'execution_id': 
'de233e3c-c39e-44a1-96d4-4738b7af67f3'}, taskid, 
de233e3c-c39e-44a1-96d4-4738b7af67f3
   [2026-07-09 20:38:23,157: INFO/ForkPoolWorker-1] Report sent to email, 
task_id: None, notification content is None
   [2026-07-09 20:38:23,167: ERROR/ForkPoolWorker-1] A downstream exception 
occurred while generating a report: de233e3c-c39e-44a1-96d4-4738b7af67f3. 
Failed generating csv HTTP Error 500: INTERNAL SERVER ERROR
   Traceback (most recent call last):
     File "/app/superset/commands/report/execute.py", line 724, in _get_csv_data
       csv_data = self._post_chart_data(
     File "/app/superset/commands/report/execute.py", line 694, in 
_post_chart_data
       urllib.request.build_opener().open(request, timeout=timeout)  # noqa: 
S310
     File "/usr/local/lib/python3.10/urllib/request.py", line 525, in open
       response = meth(req, response)
     File "/usr/local/lib/python3.10/urllib/request.py", line 634, in 
http_response
       response = self.parent.error(
     File "/usr/local/lib/python3.10/urllib/request.py", line 563, in error
       return self._call_chain(*args)
     File "/usr/local/lib/python3.10/urllib/request.py", line 496, in 
_call_chain
       result = func(*args)
     File "/usr/local/lib/python3.10/urllib/request.py", line 643, in 
http_error_default
       raise HTTPError(req.full_url, code, msg, hdrs, fp)
   urllib.error.HTTPError: HTTP Error 500: INTERNAL SERVER ERROR
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/app/superset/tasks/scheduler.py", line 135, in execute
       ).run()
     File "/app/superset/commands/report/execute.py", line 1410, in run
       ).run()
     File "/app/superset/utils/decorators.py", line 267, in wrapped
       return on_error(ex)
     File "/app/superset/utils/decorators.py", line 232, in on_error
       raise ex
     File "/app/superset/utils/decorators.py", line 260, in wrapped
       result = func(*args, **kwargs)
     File "/app/superset/commands/report/execute.py", line 1351, in run
       ).next()
     File "/app/superset/commands/report/execute.py", line 1113, in next
       self.send()
     File "/app/superset/commands/report/execute.py", line 1005, in send
       notification_content = self._get_notification_content()
     File "/app/superset/commands/report/execute.py", line 897, in 
_get_notification_content
       csv_data = self._get_csv_data()
     File "/app/superset/commands/report/execute.py", line 753, in _get_csv_data
       raise ReportScheduleCsvFailedError(
   superset.commands.report.exceptions.ReportScheduleCsvFailedError: Failed 
generating csv HTTP Error 500: INTERNAL SERVER ERROR
   [2026-07-09 20:38:23,172: INFO/ForkPoolWorker-1] Task 
reports.execute[de233e3c-c39e-44a1-96d4-4738b7af67f3] succeeded in 
5.538199000991881s: None
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to