WebSocketClosedError

I’ve been trying to run my streamlit app through either AWS EC2 instances or streamlit sharing. Both of which have resulted in the error below.

When using a Ubuntu 18.04 server on Amazon I receive the error as soon as I access the app from outside my network and with streamlit sharing the app runs fine for a few hours then crashes with the same error.

If anyone could advise on how to deal with the following I would greatly appreciate.


2021-02-03 20:38:43.628 Task exception was never retrieved
future: <Task finished coro=<WebSocketProtocol13.write_message.<locals>.wrapper() done, defined at /usr/local/lib/python3.7/site-packages/tornado/websocket.py:1100> exception=WebSocketClosedError()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/tornado/websocket.py", line 1102, 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 "/usr/local/lib/python3.7/site-packages/tornado/websocket.py", line 1104, in wrapper
    raise WebSocketClosedError()
tornado.websocket.WebSocketClosedError
2021-02-03 21:08:36.636 Task exception was never retrieved
future: <Task finished coro=<WebSocketProtocol13.write_message.<locals>.wrapper() done, defined at /usr/local/lib/python3.7/site-packages/tornado/websocket.py:1100> exception=WebSocketClosedError()>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/tornado/websocket.py", line 1102, in wrapper
    await fut
tornado.iostream.StreamClosedError: Stream is closed

Hi @Gishei -

Is there a link to your code that you can provide, so that we can try to troubleshoot?

Best,
Randy

Hi @randyzwitch

All the code for the project can be found here: GitHub - jrilett/FilmClubStreamlit

Specifically the FilmsStatistics.py file is the one used for the app.

Many thanks

I don’t see anything obvious that would lead to a WebSocketClosedError, but these two lines aren’t doing what you think:

The cache decorator is applied to specific functions, not as a global assignment. So your app isn’t actually caching data. I would suggest removing that code, applying caching to your data load from Google, and see if things improve.