jaedb / Iris

Discover, explore and manage your music library across multiple sources with this beautiful web-based interface. Iris is a Mopidy frontend extension.
Apache License 2.0
1.13k stars 131 forks source link

mopidy iris websocket connection closes due to uncaught exception #932

Open mgoltzsche opened 10 months ago

mgoltzsche commented 10 months ago

Iris version

3.68.0

Operating system(s) affected

Browser(s) affected

What happened?

I have an Iris installation running on my raspberry pi that I didn't update for some time since it was working fine. Now, since a while, Iris permanently shows error notifications saying something about the websocket being closed and is apparently unsuccessfully retrying. mopidy logs a corresponding error every 5 seconds.

Fortunately, mopidy is still playing music.

After clearing my browser cache and storage as suggested within another issue, the error logs and notifications disappeared.

Now I wonder: Did the problem exist since the last Iris update? Did the Iris update broke my mopidy installation (which I didn't update myself explicitly)? Is it possible that Iris is dynamically loading something from the newer version in the web into the older installation that resulted in compatibility problems? If so, I wonder whether that could be prevented? A mopidy Iris installation should not change, unless I install an update explicitly.

Logs

ERROR    2023-11-12 00:27:38,455 [14:HttpServer] tornado.application
  Uncaught exception GET /iris/ws/ (10.42.0.1)
HTTPServerRequest(protocol='http', host='kubemate-a33a', method='GET', uri='/iris/ws/', version='HTTP/1.1', remote_ip='10.42.0.1')
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/tornado/websocket.py", line 937, in _accept_connection
    open_result = handler.open(*handler.open_args, **handler.open_kwargs)
  File "/usr/lib/python3.10/site-packages/mopidy_iris/handlers.py", line 48, in open
    iris.add_connection(connection=self, client=client)
  File "/usr/lib/python3.10/site-packages/mopidy_iris/core.py", line 282, in add_connection
    self.broadcast(
  File "/usr/lib/python3.10/site-packages/mopidy_iris/core.py", line 236, in broadcast
    connection["connection"].write_message(json_encode(message))
  File "/usr/lib/python3.10/site-packages/tornado/websocket.py", line 331, in write_message
    raise WebSocketClosedError()
tornado.websocket.WebSocketClosedError

Relates to #405, #410

jaedb commented 10 months ago

Can you please try a hard refresh on all open browsers? I suspect you have one or more browsers using the older version of Iris frontend, which may be using a deprecated websocket connection structure. As a result, the up-to-date Iris backend rejects it.

If this resolves the issue then we will know the initial connection request is the culprit.

mgoltzsche commented 9 months ago

Since I refreshed my browser already and deleted browser storage the problem disappeared. Though, I created this issue to get to the bottom of this: Why is Iris breaking although I did not update my mopidy/Iris installation? (In fact it is running within a custom docker container that I didn't update for a while.)