Stuck on "... CONNECTING" after idling for a while


When I come back to my streamlit page that has been idle for a while (open, but in a background browser tab), I would get a blank page, or a non-responsive/widgets-grayed-out page with the “… CONNECTING” message. “Idle a while” being around 15 min I think; maybe shorter, but I believe 5 min is not enough.

The page would recover after I switch back to it, but the recovery period would be quite long (30 sec to a minute). Usually I don’t want to wait that long, so I would reload the page to recover.

This was not an issue in the prior version, 1.19.0.
Edit: this happens in 1.19.0 too, I just noticed. So it must be something with our code! :frowning:

If it makes any difference, my app uses asyncio with an infinite loop, as a way to take in streaming data. When it is working as expected, it would say “RUNNING…” pretty much all the time, as it gathers and displays incoming data.

Hope you will be able to look into the issue. Thank you very much.

Debug info

  • Streamlit version: 1.20.0, 1.19.0
  • Python version: 3.8
  • Pip
  • OS version: Linux & Windows
  • Browser version: Chrome & Edge

Could you share the repository you are using, or a simplified script that reproduces this issue?

Thanks for the reply @blackary. Unfortunately I cannot share the code we have, but I am trying to replicate this in a smaller script. So far unsuccessful…

In the meanwhile, I notice that we get a few of these (non fatal?) errors in our logs. Not sure if they are related?

2023-03-29 12:13:14.080 Task exception was never retrieved
future: <Task finished name=‘Task-372200’ coro=<WebSocketProtocol13.write_message..wrapper() done, defined at …/lib/python3.8/site-packages/tornado/> exception=WebSocketClosedError()>
Traceback (most recent call last):
File “…/lib/python3.8/site-packages/tornado/”, line 1092, in wrapper
await fut
tornado.iostream.StreamClosedError: Stream is closed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “…/lib/python3.8/site-packages/tornado/”, line 1094, in wrapper
raise WebSocketClosedError()

Hi, I just updated my original post to say that this issue happens on 1.19.0 also. It must be how we are implementing our app. Still having trouble reproducing in a simpler test app though.

I have not managed to capture the problem in a test app; therefore I will close this issue for now. Will open a new discussion if I have something more concrete. Thanks for your time.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.