_validate.py "RuntimeError: dictionary changed size during iteration"
Environment
dash 2.17.1
dash-bootstrap-components 1.5.0
dash-bootstrap-templates 1.0.8
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-loading-spinners 1.0.2
dash-table 5.0.0
Describe the bug
When starting a large Dash app (couple hundred callbacks, large callback chains) I receive the following error on startup and access to the application for the first time.
[2024-07-20 11:22:42,611] ERROR in app: Exception on /auth/dashboards/_dash-component-suites/dash/deps/[email protected]_17_1m1721474206.14.0.min.js [GET]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 878, in full_dispatch_request
rv = self.preprocess_request()
File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1253, in preprocess_request
rv = self.ensure_sync(before_func)()
File "/usr/local/lib/python3.10/site-packages/dash/dash.py", line 1430, in _setup_server
_validate.validate_long_callbacks(self.callback_map)
File "/usr/local/lib/python3.10/site-packages/dash/_validate.py", line 528, in validate_long_callbacks
for callback in callback_map.values():
RuntimeError: dictionary changed size during iteration
This prevents the page from loading; however, I can perform a full refresh (ctrl-F5 on firefox) and everything will load correctly. This only occurs once, and only for the first user visiting the app. Occurs most times after starting the app. I have 1 callback which utilizes celery, but other than that no other long_callbacks in the app. Seems to occur more frequently when the overall number of callbacks increases in the application.
I believe this is connected to the same issue... here's another error that occurs on first access to application after startp, but never shows again
[2024-07-20 06:52:47,416] ERROR in app: Exception on /_dash-component-suites/dash/deps/[email protected]_17_1m1720625729.8.1.min.js [GET]
Traceback (most recent call last):
File "/config/workspace/tdb_alphabi/.venv/lib/python3.10/site-packages/flask/app.py", line 1473, in wsgi_app
response = self.full_dispatch_request()
File "/config/workspace/tdb_alphabi/.venv/lib/python3.10/site-packages/flask/app.py", line 882, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/config/workspace/tdb_alphabi/.venv/lib/python3.10/site-packages/flask/app.py", line 880, in full_dispatch_request
rv = self.dispatch_request()
File "/config/workspace/tdb_alphabi/.venv/lib/python3.10/site-packages/flask/app.py", line 865, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) # type: ignore[no-any-return]
File "/config/workspace/tdb_alphabi/.venv/lib/python3.10/site-packages/dash/dash.py", line 989, in serve_component_suites
_validate.validate_js_path(self.registered_paths, package_name, path_in_pkg)
File "/config/workspace/tdb_alphabi/.venv/lib/python3.10/site-packages/dash/_validate.py", line 373, in validate_js_path
raise exceptions.DependencyException(
dash.exceptions.DependencyException: Error loading dependency. "dash" is not a registered library.
Registered libraries are:
[]