matrix-org / matrix-org/matrix-python-sdk

JSONDecodeError when trying to interact with user in a non-healthy server

Open
#282 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
266
Forks
118
PR merge metrics
No merged PRs in 30d

Description

We got a small federation running for Raiden Network, and because of some disk full issue, one of the servers crashed. Following it, the healthy ones started returning some unexpected responses for interactions with users on the healthy ones.
E.g. trying to invite an user in the unhealthy server to a room in the healthy one, the invite request returned:

<Response [429]>
{"errcode":"M_UNKNOWN","error":"Unknown Status"}

but from
https://github.com/matrix-org/matrix-python-sdk/blob/e366d52850f2bd948e9613022b735054616cfe0b/matrix_client/api.py#L731-L735
if the error isn't a json, json.JSONDecodeError will be raised.
Quick fix is to add json.JSONDecodeError to the handled errors in L734
Full stack traces and context can be found in raiden-network/raiden#2603

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in matrix_client/api.py around lines 731-735, where non-JSON error responses are parsed and handled. Reproduce the 429 response containing the shown error payload, then verify that the interaction follows the existing handled-error path without raising JSONDecodeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.