element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.01k stars 1.96k forks source link

X-signing: error message and prompt to enable MAS temporary key reset doesn't display for ~20 seconds #27863

Closed wrjlewis closed 3 days ago

wrjlewis commented 1 month ago

Steps to reproduce

  1. Where are you starting? What can you see? Element Web on Chromium
  2. What do you click? In settings, key reset
  3. More steps… Go through the cross signing key reset flow, which will eventually fail and show an error message, prompting the user to enable key reset temporarily within MAS

That error message takes up to 20 seconds to display, while a loading icon spins, and in the background numerous attempts to /upload fail

Outcome

What did you expect?

The error message to appear within an acceptable period, within a couple seconds?

What happened instead?

It retries the failing upload request so many times that the error doesn't appear for 20 or so seconds, at which point the user would have probably given up already.

What would be great?

If the error message appeared more quickly, and there is an option to 'retry' once the user has enabled the option in MAS to allow key-resetting.

Operating system

MacOS

Browser information

Version 1.52.0 (51895) Chromium Engine Version 126.0.6478.183

URL for webapp

element.elementdemo.will (local ESS install)

Application version

Element version: 1.11.69 Crypto version: Rust SDK 0.7.0 (068a0af), Vodozemac 0.6.0

Homeserver

No response

Will you send logs?

No

t3chguy commented 1 month ago

The slowness here is due to https://github.com/matrix-org/matrix-js-sdk/pull/4061

richvdh commented 1 month ago

What exactly is the error code returned by /keys/upload? The retry logic should only retry after HTTP 500 errors and the like.

t3chguy commented 1 month ago

The PR makes it retry on anything that is !res.ok as far as I can tell. It is relying on http-api/fetch to make the distinction by throwing when !ok - it lost its status code filtering during review.

Fetch ok only considers statuses in the 200-299 range: https://developer.mozilla.org/en-US/docs/Web/API/Response/ok

richvdh commented 1 month ago

Per the discussion on https://github.com/matrix-org/matrix-js-sdk/pull/4061, I don't think that's correct