matrix-org / dendrite

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

Crash on appservice registration after updating to v0.3.11 #1780

Closed jaywink closed 3 years ago

jaywink commented 3 years ago

Background information

Description

Updated to v0.3.11 and it crashed on start-up trying to create the appservice user. The appservice has not changed, it has been existing with the same configuration since installing Dendrite. Rolling back to v0.3.10 starts up fine.

From logs:

time="2021-03-02T19:14:40.867387118Z" level=panic msg="failed to generate bot account for appservice" func="NewInternalAPI\n\t" file=" [github.com/matrix-org/dendrite/appservice/appservice.go:75]" appservice=socialhome-network error="Username already exists"
panic: (*logrus.Entry) 0xc00010dab0

goroutine 1 [running]:
github.com/sirupsen/logrus.Entry.log(0xc0000f2c40, 0xc0000356e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    github.com/sirupsen/logrus@v1.7.0/entry.go:255 +0x325
github.com/sirupsen/logrus.(*Entry).Log(0xc00010da40, 0x0, 0xc000287808, 0x1, 0x1)
    github.com/sirupsen/logrus@v1.7.0/entry.go:283 +0xf0
github.com/sirupsen/logrus.(*Entry).Logf(0xc00010da40, 0xc000000000, 0x118ad52, 0x2d, 0x0, 0x0, 0x0)
    github.com/sirupsen/logrus@v1.7.0/entry.go:329 +0xe5
github.com/sirupsen/logrus.(*Entry).Panicf(...)
    github.com/sirupsen/logrus@v1.7.0/entry.go:367
github.com/matrix-org/dendrite/appservice.NewInternalAPI(0xc000197480, 0x12f7d00, 0xc0000b1b00, 0x1300c60, 0xc000190300, 0xc00010d650, 0x12f21a0)
    github.com/matrix-org/dendrite/appservice/appservice.go:75 +0x8eb
main.main()
    github.com/matrix-org/dendrite/cmd/dendrite-monolith-server/main.go:124 +0x52d

Appservice config:

{
  'as_token': 'redacted', 
  'hs_token': 'redacted', 
  'id': 'socialhome-network', 
  'namespaces': {
    'aliases': [
      {'exclusive': False, 'regex': '#.*'}, 
      {'exclusive': True, 'regex': '#_socialhome_.*'}
    ], 
    'rooms': [], 
    'users': [
      {'exclusive': False, 'regex': '@.*'}, 
      {'exclusive': True, 'regex': '@_socialhome_.*'}
    ]
  }, 
  'sender_localpart': '_socialhome', 
  'url': 'https://jasonrobinson.me/matrix'
}
jaywink commented 3 years ago

Likely this? https://github.com/matrix-org/dendrite/commit/f5cf2418776f0117455eb4156eabdc6dbcf9c1ee

Can provide data. Can't remember how I registered the appservice user :thinking: Maybe something related to that? But if the user already exists, one would expect it to be fine with it.

neilalexander commented 3 years ago

@jaywink Can you please try #1782 to see if that fixes the issue?

jaywink commented 3 years ago

Built an image with 0.3.11 + 1782 and it works, thanks for the fast fix! <3