matrix-org / matrix-org/matrix-rust-sdk

Building a client is very slow to fail if the server doesn't respond.

Open
#3,699 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.3k
Forks
500
Avg merge
1d 16h
Merged PRs (30d)
106

Description

Element X is building a client during login using `ClientBuilder::server_name_or_homeserver_url` which is passed the user input homeserver (usually `matrix.org`, so the server name). When entering a server that doesn't respond, building the client used to timeout in 30 seconds which is possibly a bit long to wait, but definitely isn't too long.

Recently however it takes 3 minutes as we're now retrying the request 3 times, and then we introduced the `/versions` call which will also be retried 3 times.

Notes from @poljar:

> Perhaps a regression due to: https://github.com/matrix-org/matrix-rust-sdk/pull/3539/commits/00a2601773c75a7df2b4e5b8a705be5f3ebbdd66
>
> Requests the client makes during the building phase should all use the short retry logic.

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 ClientBuilder::server_name_or_homeserver_url and trace the requests made while building a client, including the /versions call and their retry configuration. Compare these requests with the short retry logic and verify that an unresponsive server fails within the intended shorter period without unnecessary retries.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.