question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gracefully handle when rooms in space pagination token expires - Unable to paginate rooms in the space `/hierarchy` -> 400 `Unknown pagination token`

See original GitHub issue

Steps to reproduce

  1. Go to the space home
  2. Scroll and paginate the rooms in the space until you get stuck
    • Maybe this matters, I was also searching/filtering for a specific room before that
  3. Notice Failed to load list of rooms. message in Element and the underlying network request errors:

GET https://matrix-client.matrix.org/_matrix/client/v1/rooms/!OJBlkJuUrsKnqtNnTi%3Amatrix.org/hierarchy?suggested_only=false&from=iDciuFbCVinPIwUGYtUzQLHO&limit=20 -> ❌ 400 bad request

{"errcode":"M_INVALID_PARAM","error":"Unknown pagination token"}

I first created an issue in the Synapse tracker thinking the bad pagination token was being returned from the homeserver but it turns out there was just a 5 minute gap between pagination requests and Synapse only keeps track of pagination tokens within a 5 minute window.

What I think happened is this:

  1. Go to the space home
  2. Search/filter for a specific room
  3. Wait for the spinner appearing over and over for each /hierarchy request
    • It feels like at a certain point, the app gave up on paginating the rooms for some reason even though the loading spinner was still present. So I was waiting around even though it was doing nothing and pagination token expired behind the scenes. Is there something in the logs indicating why it would stop paginating?
  4. Get tired of waiting and clear the search/filter which reveals all rooms fetched so far
  5. Scroll down to the bottom of the list and try to paginate more
  6. Run into the Failed to load list of rooms. error and underlying network error /hierarchy ❌ 400 bad request

I think this is the last request Element made while I was searching/filtering even though it had a next_batch, and the spinner was still showing.

GET https://matrix-client.matrix.org/_matrix/client/v1/rooms/!OJBlkJuUrsKnqtNnTi%3Amatrix.org/hierarchy?suggested_only=false&from=rCkHRkRndYnCOIInVookuxrI&limit=20 -> ✅ 200 OK

date: Tue, 10 May 2022 19:02:38 GMT (response header)

{ "rooms": [...], "next_batch":"iDciuFbCVinPIwUGYtUzQLHO" }

Then 7 minutes later, I cleared the search/filter and tried paginating manually by scrolling to the bottom of the list:

GET https://matrix-client.matrix.org/_matrix/client/v1/rooms/!OJBlkJuUrsKnqtNnTi%3Amatrix.org/hierarchy?suggested_only=false&from=iDciuFbCVinPIwUGYtUzQLHO&limit=20 -> ❌ 400 Bad request

date: Tue, 10 May 2022 19:08:58 GMT (response header)

{"errcode":"M_INVALID_PARAM","error":"Unknown pagination token"}

Outcome

What did you expect?

  1. Element keeps paginating while the loading spinner is visible when searching/filtering
  2. Element gracefully fetches a new pagination token after the 5 minute expiration (we have to paginate from the beginning again)
  3. All of these problems are exacerbated because searching a space is painfully slow and there is no server endpoint to do it directly.

What happened instead?

  • Element stopped paginating and showed an error: Failed to load list of rooms..
  • Element also continuously retries the request over and over with no back-off.

Logs: https://github.com/matrix-org/element-web-rageshakes/issues/12829

Operating system

Windows 10

Browser information

Chrome Version 100.0.4896.127

URL for webapp

https://develop.element.io/

Application version

Element version: 479d4bf64d97-react-14127c777b87-js-34cfa511049e Olm version: 3.2.8

Homeserver

matrix.org

Will you send logs?

Yes -> https://github.com/matrix-org/element-web-rageshakes/issues/12829

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
robintowncommented, May 12, 2022

Downgrading this to occasional and minor, since I don’t believe this happens super regularly, and the workaround is to reopen the space landing page and try again

1reaction
turt2livecommented, May 10, 2022

per https://github.com/matrix-org/synapse/issues/12697#issuecomment-1122947619 I am reopening this as a client-side problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ListActivities - AWS Step Functions
Each pagination token expires after 24 hours. Using an expired pagination token will return an HTTP 400 InvalidToken error.
Read more >
Cisco SD-WAN Command Reference - Operational ...
Cloud-init information includes a token, vBond orchestrator IP address, and organization name (on vEdge Cloud routers only).
Read more >
Openfire Changelog - Ignite Realtime Downloads
[OF-2153] - Gracefully handle SM resumption requests on other cluster nodes. [OF-2162] - Add 'ofrom' to MUC private messages; [OF-2170] - LDAP UserDN ......
Read more >
draft-ietf-core-resource-directory-17 - IETF Datatracker
Expires April 26, 2019 [Page 2] Internet-Draft CoRE Resource Directory October 2018 ... In link-format serialization, they are expressed as space- separated ...
Read more >
401 Error when attempting to paginate endpoint in Users Api
I've attempted generating a new API token for each pagination, but that appears to cause either 401 or 429 issues.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found