Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

guest account registration sometimes wedges after a restart #5225

Closed
richvdh opened this issue May 21, 2019 · 6 comments
Closed

guest account registration sometimes wedges after a restart #5225

richvdh opened this issue May 21, 2019 · 6 comments
Labels
z-bug (Deprecated Label) z-p2 (Deprecated Label)

Comments

@richvdh
Copy link
Member

richvdh commented May 21, 2019

at restart, we try to calculate the next generated user id, which requires a table-scan which may take many seconds. If we don't manage to correctly calculate it before the next request turns up, then we end up stuck in a loop where both requests repeatedly get allocated the same user id and we never manage to break out of it

@neilisfragile neilisfragile added z-bug (Deprecated Label) z-p2 (Deprecated Label) labels May 24, 2019
@richvdh
Copy link
Member Author

richvdh commented Jun 10, 2019

for future reference: the symptoms of this happening include lots of matches for:

grep 'Received response to .*/register_user/%40[1-9].*: 400' var/client_reader2.log

@richvdh
Copy link
Member Author

richvdh commented Oct 2, 2019

this is trivially fixed with a lock...

@richvdh
Copy link
Member Author

richvdh commented Oct 24, 2019

fixed by #6161

@richvdh richvdh closed this as completed Oct 24, 2019
@richvdh
Copy link
Member Author

richvdh commented Nov 5, 2019

apparently not fixed

@richvdh richvdh reopened this Nov 5, 2019
@richvdh
Copy link
Member Author

richvdh commented Nov 5, 2019

There are a couple of problems with the current implementation:

  • find_next_generated_user_id_localpart always returns zero. Despite going to a great deal of effort to pull all of the numeric user ids out of the database (which is an operation that takes a great deal of CPU and memory), it does not pull out @0:matrix.org, so assumes it is free. We therefore try to register every single userid in turn, starting at zero, until we find a spare one. This takes ages, and leads to a significant amount of hammering on the master.
  • But wait! there's more! register_with_store has a ratelimiter which causes it to raise an exception if you call it too often, which makes this loop tight-loop, blocking the entire reactor until the ratelimit clears.

@richvdh
Copy link
Member Author

richvdh commented Nov 7, 2019

hopefully fixed again by #6338

@richvdh richvdh closed this as completed Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label) z-p2 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

2 participants