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

TCP timeout

Open
#129 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Api layer enhancement good first issue
Dominant language
Python
Stars
266
Forks
118
PR merge metrics
No merged PRs in 30d

Description

Right now, the only timeout in the sdk is the server-side sync timeout. No client-side timeout is specified. This means that, under some network conditions, requests may hang indefinitely.

In particular, this makes a thread running client.listen_forever freeze for me once every few days on a VPS or sometimes when moving between wifi networks on a laptop (makes using the sdk for a long-running chatbot kinda annoying).

Passing a timeout into requests.request() seems to fix it, throwing an exception as desired.

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 at client.listen_forever and trace the request path to requests.request(), which the issue identifies as the place where a timeout can be passed. Determine how the client-side timeout should apply to long-running requests, then verify that stalled network requests no longer hang indefinitely and instead raise an exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.