matrix-org / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://matrix-org.github.io/dendrite/
Apache License 2.0
5.75k stars 676 forks source link

Dendrite puts Element into a loop that floods requests, when a user's attempt to register fails because username already exists. Synapse doesn't. #1999

Closed techmindful closed 2 years ago

techmindful commented 3 years ago

Background information

Description

This may look like an Element issue, but it doesn't happen if I use Synapse (Debian pre-built package from Apt, version 1.41.1+buster1). So I decided to post it here.

After building and running Dendrite, I followed the steps here to start working on Element locally. If I try to register with a username that already exists, the browser's developer console gets flooded with:

POST http://localhost:8008/_matrix/client/r0/register 429 (Too Many Requests)
Active flow => {"stages":["m.login.dummy"]}
Next stage: m.login.dummy

Sometimes the 429 is replaced with 400. Element seems to constantly loop back to this line of code.

Steps to reproduce

Here's the log from Dendrite:

INFO[2021-09-02T08:22:41.805652685Z] [base.go:113] NewBaseDendrite                                                                                                           
         Dendrite version 0.5.0-rc1+329c9e67                                                                                                                                 
INFO[2021-09-02T08:22:41.806983568Z] [signingkeyserver.go:103] NewInternalAPI                                                                                                
         Enabled perspective key fetcher               num_public_keys=2 server_name=matrix.org                                                                              
INFO[2021-09-02T08:22:41.819530029Z] [base.go:429] func2                                                                                                                     
         Starting external Monolith listener on :8008                                                                                                                        
INFO[2021-09-02T08:22:41.819557285Z] [base.go:429] func2                                                                                                                     
         Starting external Monolith listener on :8448                                                                                                                        
INFO[2021-09-02T08:22:55.948568850Z] [register.go:523] Register                                                                                                              
         Processing registration request               auth.type="" req.id=vPFcV9fCzRLV req.method=POST req.path=/_matrix/client/r0/register session_id="" username=test0    
INFO[2021-09-02T08:22:55.963175774Z] [register.go:523] Register                                                                                                              
         Processing registration request               auth.type=m.login.dummy req.id=hV7XVH20DKXA req.method=POST req.path=/_matrix/client/r0/register session_id=dPJfOTuSm8
mCCawZqx5EX6Ra username=test0                                                                                                                                                
INFO[2021-09-02T08:22:56.028506904Z] [register.go:523] Register                                                                                                              
         Processing registration request               auth.type=m.login.dummy req.id=4eBO5kyAwTQe req.method=POST req.path=/_matrix/client/r0/register session_id=dPJfOTuSm8
mCCawZqx5EX6Ra username=test0                                                                                                                                                
INFO[2021-09-02T08:22:56.110464955Z] [register.go:523] Register                                                                                                              
         Processing registration request               auth.type=m.login.dummy req.id=UogiwYCpKflz req.method=POST req.path=/_matrix/client/r0/register session_id=dPJfOTuSm8
mCCawZqx5EX6Ra username=test0
...

The rest of the logs are all repetitions of the last line.

kegsay commented 2 years ago

Cannot reproduce on:

Element version: 869b271f72f9-react-869b271f72f9-js-869b271f72f9
Olm version: 3.2.8
Screenshot 2022-01-21 at 10 56 56