You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Wetbikeboy2500 (via GitHub)" <gi...@apache.org> on 2026/06/09 11:53:04 UTC
[I] Data error Error: deque mutated during iteration [superset]
Wetbikeboy2500 opened a new issue, #40903:
URL: https://github.com/apache/superset/issues/40903
### Bug description
I pulled the latest master and started to get these chart errors. Prior to pulling in the commits for around the past month, I never saw errors like these. After pulling the last month of commits and doing a quick run locally, I am occasionally seeing these errors for charts.
### Screenshots/recordings
<img width="1850" height="891" alt="Image" src="https://github.com/user-attachments/assets/5a6f5648-a0a4-4072-b170-31c97376f750" />
### Superset version
master / latest-dev
### Python version
3.11
### Node version
18 or greater
### Browser
Chrome
### Additional context
Dev Docker Compose build
2026-06-09 07:19:23.882 | 2026-06-09 11:19:23,882:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:23] "GET /api/v1/dashboard/1/charts HTTP/1.1" 200 -
2026-06-09 07:19:23.913 | 2026-06-09 11:19:23,913:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:23] "GET /api/v1/dashboard/1?q=(columns:!(id,slug,url,dashboard_title,published,css,theme,json_metadata,position_json,certified_by,certification_details,changed_by_name,changed_by,changed_on,created_by,charts,owners,roles,tags,changed_on_delta_humanized,created_on_delta_humanized,is_managed_externally,uuid)) HTTP/1.1" 200 -
2026-06-09 07:19:23.988 | 2026-06-09 11:19:23,988:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:23] "GET /api/v1/dashboard/1/datasets HTTP/1.1" 200 -
2026-06-09 07:19:24.668 | 2026-06-09 11:19:24,668:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:24] "GET /api/v1/dashboard/favorite_status/?q=!(1) HTTP/1.1" 200 -
2026-06-09 07:19:24.729 | 2026-06-09 11:19:24,728:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:24] "GET /api/v1/report/?q=(filters:!((col:dashboard_id,opr:eq,value:1),(col:creation_method,opr:eq,value:dashboards),(col:created_by,opr:rel_o_m,value:1))) HTTP/1.1" 200 -
2026-06-09 07:19:25.488 | 2026-06-09 11:19:25,488:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:25] "GET /api/v1/dataset/13/drill_info/?q=(dashboard_id:1) HTTP/1.1" 200 -
2026-06-09 07:19:25.503 | 2026-06-09 11:19:25,502:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:25] "GET /api/v1/dataset/3/drill_info/?q=(dashboard_id:1) HTTP/1.1" 200 -
2026-06-09 07:19:25.517 | 2026-06-09 11:19:25,516:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:25] "GET /api/v1/dataset/6/drill_info/?q=(dashboard_id:1) HTTP/1.1" 200 -
2026-06-09 07:19:25.752 | 2026-06-09 11:19:25,567:WARNING:superset.models.helpers:Query SELECT DATE_TRUNC('week', order_date) AS order_date, deal_size AS deal_size, sum(sales) AS "SUM(sales)"
2026-06-09 07:19:25.752 | FROM public.cleaned_sales_data GROUP BY DATE_TRUNC('week', order_date), deal_size ORDER BY "SUM(sales)" DESC
2026-06-09 07:19:25.752 | LIMIT 10000 on schema public failed
2026-06-09 07:19:25.752 | Traceback (most recent call last):
2026-06-09 07:19:25.752 | File "/app/superset/models/helpers.py", line 1523, in query
2026-06-09 07:19:25.752 | df = self.database.get_df(
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/superset/models/core.py", line 822, in get_df
2026-06-09 07:19:25.752 | cursor, rows, description = self._execute_sql_with_mutation_and_logging(
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/superset/models/core.py", line 758, in _execute_sql_with_mutation_and_logging
2026-06-09 07:19:25.752 | with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
2026-06-09 07:19:25.752 | return next(self.gen)
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/superset/models/core.py", line 647, in get_raw_connection
2026-06-09 07:19:25.752 | with closing(engine.raw_connection()) as conn:
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
2026-06-09 07:19:25.752 | return self._wrap_pool_connect(self.pool.connect, _connection)
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
2026-06-09 07:19:25.752 | return fn()
2026-06-09 07:19:25.752 | ^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 327, in connect
2026-06-09 07:19:25.752 | return _ConnectionFairy._checkout(self)
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
2026-06-09 07:19:25.752 | fairy = _ConnectionRecord.checkout(pool)
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
2026-06-09 07:19:25.752 | rec = pool._do_get()
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
2026-06-09 07:19:25.752 | return self._create_connection()
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
2026-06-09 07:19:25.752 | return _ConnectionRecord(self)
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
2026-06-09 07:19:25.752 | self.__connect()
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 704, in __connect
2026-06-09 07:19:25.752 | )._exec_w_sync_on_first_run(self.dbapi_connection, self)
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 332, in _exec_w_sync_on_first_run
2026-06-09 07:19:25.752 | self(*args, **kw)
2026-06-09 07:19:25.752 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 345, in __call__
2026-06-09 07:19:25.752 | for fn in self.listeners:
2026-06-09 07:19:25.752 | ^^^^^^^^^^^^^^
2026-06-09 07:19:25.752 | RuntimeError: deque mutated during iteration
2026-06-09 07:19:25.768 | 2026-06-09 11:19:25,680:WARNING:superset.models.helpers:Query SELECT DATE_TRUNC('month', order_date) AS order_date, COUNT(*) AS count
2026-06-09 07:19:25.768 | FROM public.cleaned_sales_data GROUP BY DATE_TRUNC('month', order_date)
2026-06-09 07:19:25.768 | LIMIT 50000 on schema public failed
2026-06-09 07:19:25.768 | Traceback (most recent call last):
2026-06-09 07:19:25.768 | File "/app/superset/models/helpers.py", line 1523, in query
2026-06-09 07:19:25.768 | df = self.database.get_df(
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/superset/models/core.py", line 822, in get_df
2026-06-09 07:19:25.768 | cursor, rows, description = self._execute_sql_with_mutation_and_logging(
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/superset/models/core.py", line 758, in _execute_sql_with_mutation_and_logging
2026-06-09 07:19:25.768 | with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
2026-06-09 07:19:25.768 | return next(self.gen)
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/superset/models/core.py", line 647, in get_raw_connection
2026-06-09 07:19:25.768 | with closing(engine.raw_connection()) as conn:
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
2026-06-09 07:19:25.768 | return self._wrap_pool_connect(self.pool.connect, _connection)
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
2026-06-09 07:19:25.768 | return fn()
2026-06-09 07:19:25.768 | ^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 327, in connect
2026-06-09 07:19:25.768 | return _ConnectionFairy._checkout(self)
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
2026-06-09 07:19:25.768 | fairy = _ConnectionRecord.checkout(pool)
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
2026-06-09 07:19:25.768 | rec = pool._do_get()
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
2026-06-09 07:19:25.768 | return self._create_connection()
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
2026-06-09 07:19:25.768 | return _ConnectionRecord(self)
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
2026-06-09 07:19:25.768 | self.__connect()
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 704, in __connect
2026-06-09 07:19:25.768 | )._exec_w_sync_on_first_run(self.dbapi_connection, self)
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 338, in _exec_w_sync_on_first_run
2026-06-09 07:19:25.768 | self(*args, **kw)
2026-06-09 07:19:25.768 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 345, in __call__
2026-06-09 07:19:25.768 | for fn in self.listeners:
2026-06-09 07:19:25.768 | ^^^^^^^^^^^^^^
2026-06-09 07:19:25.768 | RuntimeError: deque mutated during iteration
2026-06-09 07:19:25.830 | 2026-06-09 11:19:25,829:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:25] "POST /api/v1/chart/data?form_data={"slice_id":19}&dashboard_id=1 HTTP/1.1" 400 -
2026-06-09 07:19:25.834 | 2026-06-09 11:19:25,833:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:25] "POST /api/v1/chart/data?form_data={"slice_id":11}&dashboard_id=1 HTTP/1.1" 400 -
2026-06-09 07:19:25.983 | 2026-06-09 11:19:25,983:WARNING:py.warnings:/app/superset/utils/pandas_postprocessing/aggregate.py:46: FutureWarning: The provided callable <function mean at 0x74968a30d580> is currently using SeriesGroupBy.mean. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "mean" instead.
2026-06-09 07:19:25.983 | return df_groupby.agg(**aggregate_funcs).reset_index(drop=not groupby)
2026-06-09 07:19:25.983 |
2026-06-09 07:19:25.989 | 2026-06-09 11:19:25,989:WARNING:py.warnings:/app/superset/utils/pandas_postprocessing/aggregate.py:46: FutureWarning: The provided callable <function median at 0x749689db20c0> is currently using SeriesGroupBy.median. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass the string "median" instead.
2026-06-09 07:19:25.990 | return df_groupby.agg(**aggregate_funcs).reset_index(drop=not groupby)
2026-06-09 07:19:25.990 |
2026-06-09 07:19:26.189 | 2026-06-09 11:19:26,189:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":12}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:26.229 | 2026-06-09 11:19:26,229:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":4}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:26.369 | 2026-06-09 11:19:26,368:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":13}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:26.398 | 2026-06-09 11:19:26,398:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":23}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:26.556 | 2026-06-09 11:19:26,555:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":5}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:26.769 | 2026-06-09 11:19:26,769:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":9}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:26.808 | 2026-06-09 11:19:26,807:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:26] "POST /api/v1/chart/data?form_data={"slice_id":17}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.005 | 2026-06-09 11:19:27,004:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":15}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.077 | 2026-06-09 11:19:27,076:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":21}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.171 | 2026-06-09 11:19:27,171:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":8}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.310 | 2026-06-09 11:19:27,310:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":3}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.370 | 2026-06-09 11:19:27,360:WARNING:superset.models.helpers:Query SELECT product_line AS product_line, COUNT(*) AS count, AVG(price_each) AS "AVG(price_each)", AVG(sales) AS "AVG(sales)"
2026-06-09 07:19:27.370 | FROM public.cleaned_sales_data GROUP BY product_line ORDER BY count DESC
2026-06-09 07:19:27.370 | LIMIT 10 on schema public failed
2026-06-09 07:19:27.370 | Traceback (most recent call last):
2026-06-09 07:19:27.370 | File "/app/superset/models/helpers.py", line 1523, in query
2026-06-09 07:19:27.370 | df = self.database.get_df(
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/superset/models/core.py", line 822, in get_df
2026-06-09 07:19:27.370 | cursor, rows, description = self._execute_sql_with_mutation_and_logging(
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/superset/models/core.py", line 758, in _execute_sql_with_mutation_and_logging
2026-06-09 07:19:27.370 | with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
2026-06-09 07:19:27.370 | return next(self.gen)
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/superset/models/core.py", line 647, in get_raw_connection
2026-06-09 07:19:27.370 | with closing(engine.raw_connection()) as conn:
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
2026-06-09 07:19:27.370 | return self._wrap_pool_connect(self.pool.connect, _connection)
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
2026-06-09 07:19:27.370 | return fn()
2026-06-09 07:19:27.370 | ^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 327, in connect
2026-06-09 07:19:27.370 | return _ConnectionFairy._checkout(self)
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
2026-06-09 07:19:27.370 | fairy = _ConnectionRecord.checkout(pool)
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
2026-06-09 07:19:27.370 | rec = pool._do_get()
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
2026-06-09 07:19:27.370 | return self._create_connection()
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
2026-06-09 07:19:27.370 | return _ConnectionRecord(self)
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
2026-06-09 07:19:27.370 | self.__connect()
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 704, in __connect
2026-06-09 07:19:27.370 | )._exec_w_sync_on_first_run(self.dbapi_connection, self)
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 338, in _exec_w_sync_on_first_run
2026-06-09 07:19:27.370 | self(*args, **kw)
2026-06-09 07:19:27.370 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 345, in __call__
2026-06-09 07:19:27.370 | for fn in self.listeners:
2026-06-09 07:19:27.370 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.370 | RuntimeError: deque mutated during iteration
2026-06-09 07:19:27.433 | 2026-06-09 11:19:27,433:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":25}&dashboard_id=1 HTTP/1.1" 400 -
2026-06-09 07:19:27.453 | 2026-06-09 11:19:27,437:WARNING:superset.models.helpers:Query SELECT DATE_TRUNC('day', order_date) AS order_date, deal_size AS deal_size, COUNT(*) AS count
2026-06-09 07:19:27.453 | FROM public.cleaned_sales_data GROUP BY DATE_TRUNC('day', order_date), deal_size ORDER BY count DESC
2026-06-09 07:19:27.453 | LIMIT 10000 on schema public failed
2026-06-09 07:19:27.453 | Traceback (most recent call last):
2026-06-09 07:19:27.453 | File "/app/superset/models/helpers.py", line 1523, in query
2026-06-09 07:19:27.453 | df = self.database.get_df(
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/superset/models/core.py", line 822, in get_df
2026-06-09 07:19:27.453 | cursor, rows, description = self._execute_sql_with_mutation_and_logging(
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/superset/models/core.py", line 758, in _execute_sql_with_mutation_and_logging
2026-06-09 07:19:27.453 | with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
2026-06-09 07:19:27.453 | return next(self.gen)
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/superset/models/core.py", line 647, in get_raw_connection
2026-06-09 07:19:27.453 | with closing(engine.raw_connection()) as conn:
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
2026-06-09 07:19:27.453 | return self._wrap_pool_connect(self.pool.connect, _connection)
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
2026-06-09 07:19:27.453 | return fn()
2026-06-09 07:19:27.453 | ^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 327, in connect
2026-06-09 07:19:27.453 | return _ConnectionFairy._checkout(self)
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
2026-06-09 07:19:27.453 | fairy = _ConnectionRecord.checkout(pool)
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
2026-06-09 07:19:27.453 | rec = pool._do_get()
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
2026-06-09 07:19:27.453 | return self._create_connection()
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
2026-06-09 07:19:27.453 | return _ConnectionRecord(self)
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
2026-06-09 07:19:27.453 | self.__connect()
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 704, in __connect
2026-06-09 07:19:27.453 | )._exec_w_sync_on_first_run(self.dbapi_connection, self)
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 338, in _exec_w_sync_on_first_run
2026-06-09 07:19:27.453 | self(*args, **kw)
2026-06-09 07:19:27.453 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 345, in __call__
2026-06-09 07:19:27.453 | for fn in self.listeners:
2026-06-09 07:19:27.453 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.453 | RuntimeError: deque mutated during iteration
2026-06-09 07:19:27.492 | 2026-06-09 11:19:27,491:WARNING:superset.common.query_object:The field `groupby` is deprecated, please use `columns` instead.
2026-06-09 07:19:27.492 | 2026-06-09 11:19:27,491:WARNING:superset.common.query_object:The field `columns` is already populated, replacing value with contents from `groupby`.
2026-06-09 07:19:27.508 | 2026-06-09 11:19:27,507:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":10}&dashboard_id=1 HTTP/1.1" 400 -
2026-06-09 07:19:27.534 | 2026-06-09 11:19:27,534:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":22}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.698 | 2026-06-09 11:19:27,686:WARNING:superset.models.helpers:Query SELECT year AS year, product_line AS product_line, COUNT(*) AS count
2026-06-09 07:19:27.698 | FROM public.cleaned_sales_data GROUP BY year, product_line
2026-06-09 07:19:27.698 | LIMIT 10000 on schema public failed
2026-06-09 07:19:27.698 | Traceback (most recent call last):
2026-06-09 07:19:27.698 | File "/app/superset/models/helpers.py", line 1523, in query
2026-06-09 07:19:27.698 | df = self.database.get_df(
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/superset/models/core.py", line 822, in get_df
2026-06-09 07:19:27.698 | cursor, rows, description = self._execute_sql_with_mutation_and_logging(
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/superset/models/core.py", line 758, in _execute_sql_with_mutation_and_logging
2026-06-09 07:19:27.698 | with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
2026-06-09 07:19:27.698 | return next(self.gen)
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/superset/models/core.py", line 647, in get_raw_connection
2026-06-09 07:19:27.698 | with closing(engine.raw_connection()) as conn:
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
2026-06-09 07:19:27.698 | return self._wrap_pool_connect(self.pool.connect, _connection)
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
2026-06-09 07:19:27.698 | return fn()
2026-06-09 07:19:27.698 | ^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 327, in connect
2026-06-09 07:19:27.698 | return _ConnectionFairy._checkout(self)
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
2026-06-09 07:19:27.698 | fairy = _ConnectionRecord.checkout(pool)
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
2026-06-09 07:19:27.698 | rec = pool._do_get()
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
2026-06-09 07:19:27.698 | return self._create_connection()
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
2026-06-09 07:19:27.698 | return _ConnectionRecord(self)
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
2026-06-09 07:19:27.698 | self.__connect()
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 704, in __connect
2026-06-09 07:19:27.698 | )._exec_w_sync_on_first_run(self.dbapi_connection, self)
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 338, in _exec_w_sync_on_first_run
2026-06-09 07:19:27.698 | self(*args, **kw)
2026-06-09 07:19:27.698 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 345, in __call__
2026-06-09 07:19:27.698 | for fn in self.listeners:
2026-06-09 07:19:27.698 | ^^^^^^^^^^^^^^
2026-06-09 07:19:27.698 | RuntimeError: deque mutated during iteration
2026-06-09 07:19:27.703 | 2026-06-09 11:19:27,687:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":2}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.805 | 2026-06-09 11:19:27,804:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":1}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:27.806 | 2026-06-09 11:19:27,805:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:27] "POST /api/v1/chart/data?form_data={"slice_id":7}&dashboard_id=1 HTTP/1.1" 400 -
2026-06-09 07:19:28.065 | 2026-06-09 11:19:28,064:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:28] "POST /api/v1/chart/data?form_data={"slice_id":16}&dashboard_id=1 HTTP/1.1" 200 -
2026-06-09 07:19:28.087 | 2026-06-09 11:19:28,071:WARNING:superset.models.helpers:Query SELECT DATE_TRUNC('quarter', order_date) AS order_date, sum(sales) AS "SUM(sales)"
2026-06-09 07:19:28.087 | FROM public.cleaned_sales_data GROUP BY DATE_TRUNC('quarter', order_date) ORDER BY order_date ASC
2026-06-09 07:19:28.087 | LIMIT 10000 on schema public failed
2026-06-09 07:19:28.087 | Traceback (most recent call last):
2026-06-09 07:19:28.087 | File "/app/superset/models/helpers.py", line 1523, in query
2026-06-09 07:19:28.087 | df = self.database.get_df(
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/superset/models/core.py", line 822, in get_df
2026-06-09 07:19:28.087 | cursor, rows, description = self._execute_sql_with_mutation_and_logging(
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/superset/models/core.py", line 758, in _execute_sql_with_mutation_and_logging
2026-06-09 07:19:28.087 | with self.get_raw_connection(catalog=catalog, schema=schema) as conn:
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/usr/local/lib/python3.12/contextlib.py", line 137, in __enter__
2026-06-09 07:19:28.087 | return next(self.gen)
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/superset/models/core.py", line 647, in get_raw_connection
2026-06-09 07:19:28.087 | with closing(engine.raw_connection()) as conn:
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3404, in raw_connection
2026-06-09 07:19:28.087 | return self._wrap_pool_connect(self.pool.connect, _connection)
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/engine/base.py", line 3371, in _wrap_pool_connect
2026-06-09 07:19:28.087 | return fn()
2026-06-09 07:19:28.087 | ^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 327, in connect
2026-06-09 07:19:28.087 | return _ConnectionFairy._checkout(self)
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 894, in _checkout
2026-06-09 07:19:28.087 | fairy = _ConnectionRecord.checkout(pool)
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 493, in checkout
2026-06-09 07:19:28.087 | rec = pool._do_get()
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/impl.py", line 256, in _do_get
2026-06-09 07:19:28.087 | return self._create_connection()
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 273, in _create_connection
2026-06-09 07:19:28.087 | return _ConnectionRecord(self)
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 388, in __init__
2026-06-09 07:19:28.087 | self.__connect()
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/pool/base.py", line 704, in __connect
2026-06-09 07:19:28.087 | )._exec_w_sync_on_first_run(self.dbapi_connection, self)
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 338, in _exec_w_sync_on_first_run
2026-06-09 07:19:28.087 | self(*args, **kw)
2026-06-09 07:19:28.087 | File "/app/.venv/lib/python3.12/site-packages/sqlalchemy/event/attr.py", line 345, in __call__
2026-06-09 07:19:28.087 | for fn in self.listeners:
2026-06-09 07:19:28.087 | ^^^^^^^^^^^^^^
2026-06-09 07:19:28.087 | RuntimeError: deque mutated during iteration
2026-06-09 07:19:28.158 | 2026-06-09 11:19:28,158:INFO:werkzeug:172.18.0.1 - - [09/Jun/2026 11:19:28] "POST /api/v1/chart/data?form_data={"slice_id":24}&dashboard_id=1 HTTP/1.1" 400 -
### 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.
--
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-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Data error Error: deque mutated during iteration [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #40903:
URL: https://github.com/apache/superset/issues/40903#issuecomment-4659527397
<!-- Answer -->
This looks like a race condition introduced by the combination of two recent PRs:
1. **[PR #40194](https://github.com/apache/superset/pull/40194)** (merged May 18) — added dynamic `connect` event listeners on engines to execute prequeries (e.g., `SET search_path`). These listeners are registered per-request and removed in a `finally` block .
2. **[PR #40237](https://github.com/apache/superset/pull/40237)** (merged May 30) — introduced process-wide SQLAlchemy engine caching so the same `Engine` instance is returned to multiple threads .
The problem: when multiple threads share a cached engine, one thread can call `sqla.event.listen(engine, "connect", ...)` or `sqla.event.remove(engine, "connect", ...)` while another thread is iterating over `self.listeners` inside SQLAlchemy's `_exec_w_sync_on_first_run` during `raw_connection()`. That mutates the underlying deque mid-iteration → `RuntimeError: deque mutated during iteration`.
The cache access itself is protected by `_ENGINE_CACHE_LOCK`, but the event listener registration/removal is **not** under the same (or any) lock .
**Possible workarounds until a fix lands:**
- Revert PR #40237 (engine caching) to confirm it's the culprit and eliminate the error.
- Or set `SQLALCHEMY_POOL_SIZE = 0` / use `NullPool` for the target database to reduce concurrent connection creation contention.
A proper fix would likely involve either synchronizing listener add/remove with a lock, or registering prequery listeners once at engine-creation time (inside the cache-miss path) instead of dynamically per-request.
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Share context across your team and agents. Try [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-feedback&utm_term=apache%2Fsuperset&message_id=0745d31b-63da-41f1-a5a1-20294f61c1ca) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-learn-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=knowledge-infrastructure-add-team&utm_term=apache%2Fsuperset)
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Data error Error: deque mutated during iteration [superset]
Posted by "bikash-barnwal (via GitHub)" <gi...@apache.org>.
bikash-barnwal commented on issue #40903:
URL: https://github.com/apache/superset/issues/40903#issuecomment-5298274596
This was fixed on master by #41642 (`bdc610c572`, 2026-07-02) — after the last report here (2026-06-19), which is why the published image you tested still showed it.
The comment above correctly identified the mechanism, and the fix takes exactly that route: when a database has prequeries, the engine is no longer taken from the shared cache, so the per-call `connect` listener is never added to or removed from an engine another thread is using. From `superset/models/core.py`:
```python
# Prequeries attach a per-call ``connect`` listener below
# (and remove it on exit). SQLAlchemy's listener collection
# is an unlocked deque, so mutating it on an engine shared
# via ``_ENGINE_CACHE`` races with concurrent connection
# checkouts iterating the same deque ("RuntimeError: deque
# mutated during iteration", surfacing as 500s). Request a
# private, uncached engine whenever prequeries are present
# so the listener add/remove never touches a shared object.
engine = self._get_sqla_engine(
...
cacheable=not prequeries,
)
```
The private engine is also disposed in the `finally`, so its pool is released immediately rather than lingering until GC.
Worth confirming on current master or a nightly before closing — the failure was intermittent and load-dependent, so absence over a short run isn't proof. But no further code change looks needed for the race described here.
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Data error Error: deque mutated during iteration [superset]
Posted by "Wetbikeboy2500 (via GitHub)" <gi...@apache.org>.
Wetbikeboy2500 commented on issue #40903:
URL: https://github.com/apache/superset/issues/40903#issuecomment-5358410769
Been using the latest branch for a while now and the issue has not resurfaced. Closing this
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Data error Error: deque mutated during iteration [superset]
Posted by "alesnav (via GitHub)" <gi...@apache.org>.
alesnav commented on issue #40903:
URL: https://github.com/apache/superset/issues/40903#issuecomment-4751758907
Hi there!
@rusackas , this could be another issue related to the same analysis you did here https://github.com/apache/superset/pull/40237#issuecomment-4580230683
I am testing the last published Docker image (a857964) and this issue is present.
Thanks!
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] Data error Error: deque mutated during iteration [superset]
Posted by "Wetbikeboy2500 (via GitHub)" <gi...@apache.org>.
Wetbikeboy2500 closed issue #40903: Data error Error: deque mutated during iteration
URL: https://github.com/apache/superset/issues/40903
--
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-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org