poljar / weechat-matrix

Weechat Matrix protocol script written in python
Other
957 stars 119 forks source link

Errors during connect #283

Closed wavexx closed 3 years ago

wavexx commented 3 years ago

Using matrix.org I started to have connection issues today. It's not the first time, so maybe it's just a disfunction, but it still looks like there's something wrong in matrix/matrix-nio looking at the error messages.

Right now I'm getting this:

21:27:43 matrix_org  -- | matrix: Logging in...
21:27:46 matrix_org  -- | matrix: Logged in as @xyz:matrix.org
21:27:47 matrix_org =!= | matrix: Error: SyncError: 200 unknown error
21:27:47 matrix_org  -- | matrix: disconnected from server

That "200" though makes me think otherwise. Previously I was getting this:

2021-06-29 21:12:08             python: stdout/stderr (matrix): Traceback (most recent call last):
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/home/ydelia/.weechat/python/matrix/utf.py", line 89, in wrapper
2021-06-29 21:12:08             python: stdout/stderr (matrix):     return function(*args, **kwargs)
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/home/ydelia/.weechat/python/autoload/matrix.py", line 334, in receive_cb
2021-06-29 21:12:08             python: stdout/stderr (matrix):     response = server.client.next_response()
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/usr/lib/python3/dist-packages/nio/client/http_client.py", line 1342, in next_response
2021-06-29 21:12:08             python: stdout/stderr (matrix):     response = self._create_response(
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/usr/lib/python3/dist-packages/nio/client/http_client.py", line 1277, in _create_response
2021-06-29 21:12:08             python: stdout/stderr (matrix):     response = request_class.from_dict(parsed_dict, *extra_data)
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/usr/lib/python3/dist-packages/nio/responses.py", line 170, in wrapper
2021-06-29 21:12:08             python: stdout/stderr (matrix):     return f(cls, parsed_dict, *args, **kwargs)
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/usr/lib/python3/dist-packages/nio/responses.py", line 1747, in from_dict
2021-06-29 21:12:08             python: stdout/stderr (matrix):     rooms = SyncResponse._get_room_info(parsed_dict["rooms"])
2021-06-29 21:12:08             python: stdout/stderr (matrix):   File "/usr/lib/python3/dist-packages/nio/responses.py", line 1690, in _get_room_info
2021-06-29 21:12:08             python: stdout/stderr (matrix):     for room_id, room_dict in parsed_dict["invite"].items():
2021-06-29 21:12:08             python: stdout/stderr (matrix): KeyError: 'invite'

This is an error I've seen multiple times in the past, but went away by itself. In this case I dumped the content of parsed_dict and indeed, "invite" was missing along with "leave". However after checking for these two cases explicitly in responses.py I was logged in successfully. I suppose these two keys are not mandatory when empty?

So I'm unsure whether these are disservices, or bugs..?

Tonux599 commented 3 years ago

I too have this issue that has started over the last few days. No idea how to fix it. If anyone has a hotfix it would be appreciated.

wavexx commented 3 years ago

Looks like the current version of matrix-nio from debian is too old, for one.

Using matrix-nio from master works, but I tested yesterday there's also a newer package in the experimental repository which equally connects fine. I didn't look yet if the problem with "invite" and "leave" was fixed in either the schema or code

Tonux599 commented 3 years ago

Thanks @wavexx, the following commands fixed the issue.

python3 -m pip install -U matrix-nio
python3 -m pip install -U "matrix-nio[e2e]"
wavexx commented 3 years ago

I'm closing this issue, since a current version of matrix-nio fixes it.