Skip to content

_validate.py "RuntimeError: dictionary changed size during iteration" #2925

Description

@mbworth

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/react-dom@16.v2_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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions