I have a dash application which I am running within a production environment, using gunicorn to start the server. The app contains a 1s interval callback, updating a plotly express figure and I am printing the n_iteration count in a log.
After a few hours (few thousand callback iterations) the callback hangs and the graph stops updating in the Chrome window (the status in the Chrome tab remains at “updating…”).
If I first Ctrl+C the python process, and then restart it, the log shows the iteration count that the process crashed on, and if I then try to F5 the Chrome tab, it remains stuck. Input fields’ values, which existed in the crashed server instance, are also shown in the log, as the Chrome session is still sending them back to the (new) server.
Only if I first close the Chrome tab, then Ctrl+C and restart the dash server does it begin running/updating as planned.
Is there a way to close all inbound connections, either on point of hang or when rebooting, so there is no memory/communication with a previous instance? Or a way to shut down the dashboard app and this be processed in a good way by Chrome? Or possibly a way of clearing all Chrome cached variables which are returned to the server on a startup operation?