Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Long Callback interval_time causing infinite loop #1852

Closed
kiwifoxtrot opened this issue Dec 3, 2021 · 0 comments · Fixed by #2039
Closed

[BUG] Long Callback interval_time causing infinite loop #1852

kiwifoxtrot opened this issue Dec 3, 2021 · 0 comments · Fixed by #2039

Comments

@kiwifoxtrot
Copy link

dash 2.0.0
python 3.8.8
diskcache 5.3
waitress 2.0
- OS: Windows 10
- Browser: Firefox 94.0.2, Chrome 96.0.4, Edge 96.0

The bug

Implemented a long callback for a long processing function that takes 60 - 120 seconds. The browser will start checking if the callback is finished once per second. If I run the dash code on my PC on http://127.0.0.1:8080 using either the built in Flask server or Waitress, the page will load without an issue. When deployed to a server, it will enter into an infinite loop. After 60 seconds, the title of the website will turn to "Updating..." and the content will not load. When using the built in network monitor in Firefox, there are POST requests submitted by the browser every second, followed by the the browser attempting to download data and stopping at the next post request. Due to the speed of the download, the POST request never completes and the page doesn't load.

By changing the hard coded interval_time in dash.py from 1000 to 10000 I was able to eliminate this issue. With the new settings, Firefox network monitor timed the POST response to be 3.5 seconds.

    def long_callback(self, *_args, **_kwargs):
        ...
        interval_time = _kwargs.pop("interval", 10000)

Expected behavior

When the long callback is ready for the user's browser to download, the interval_component should be disabled in an initial POST, followed by a second POST with the full data set. In the current behavior, a single POST disables the interval and delivers the full data set. If the download time exceeds the interval time, then the browser will not receive the data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants