element-hq / element-hq/synapse

`auto_join_rooms` breaks after changing

Open
#16,878 5 comments 1 reaction 0 assignees View on GitHub
X-Needs-Info
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

### Description

Troubleshooting issues with the `auto_join_rooms` Synapse configuration option, I haven't been able to get users to join rooms (/ or have them auto-created, which it should do by default).

Starting fresh to try again, I've noticed that it works the first time, but breaks as soon as you change the rooms in the `auto_join_rooms` config. The only workaround seems to be starting fresh, which isn't ideal.

[autojoin_success.log](https://github.com/element-hq/synapse/files/14112952/autojoin_success.log)
[autojoin_fail.log](https://github.com/element-hq/synapse/files/14112954/autojoin_fail.log)
[autojoin_fail_manual.log](https://github.com/element-hq/synapse/files/14112955/autojoin_fail_manual.log)

### Steps to reproduce

Starting on a fresh server with the following set:

```yml
auto_join_rooms:
- "#banana:example.com"
- "#apple:example.com"
- "#orange:example.com"
```

Works as intended, new users created either manually through the Admin API (/ console), via Delegated Auth, or through registering all join the three rooms.

However, changing the `auto_join_rooms` config seems to break it from ever working again for newly registered users. I changed it too:

```yml
auto_join_rooms:
- "#kiwi:example.com"
- "#pineapple:example.com"
- "#lemon:example.com"
```

But any new users, receive the following error when synapse tries to auto-join them:

```
synapse.handlers.register - 586 - ERROR - POST-347 - Failed to join new user to '#pineapple:example.com': SynapseError('404: Room alias #pineapple:example.com not found')
```

I have also tried manually creating a room and giving it the alias, but this then hits:

```
synapse.handlers.register - 586 - ERROR - POST-347 - Failed to join new user to '#kiwi:example.com': AssertionError()
```

### Homeserver

Custom Homeserver

### Synapse Version

1.93.0+lts.1

### Installation Method

Other (please mention below)

### Database

ESS Built-in Postgres

### Workers

Single process

### Platform

AWS `c5a.2xlarge` : 8 vCPU, 16 GB Memory
Ubuntu 22.04.3 LTS
Installed via ESS: element-installer-enterprise-edition-23.10.18-gui

### Configuration

```yml
auto_join_rooms:
- "#kiwi:example.com"
- "#pineapple:example.com"
- "#lemon:example.com"
```

### Relevant log output

```shell
See logs uploaded above:
- [autojoin_success.log](https://github.com/element-hq/synapse/files/14112952/autojoin_success.log)
- First run, auto-join rooms is successful for all newly created users
- [autojoin_fail.log](https://github.com/element-hq/synapse/files/14112954/autojoin_fail.log)
- Second run, after changing rooms in auto-join config, fails with `SynapseError('404: Room alias not found')`
- [autojoin_fail_manual.log](https://github.com/element-hq/synapse/files/14112955/autojoin_fail_manual.log)
- Third run, after manually creating the rooms (+ aliases) present in the auto-join config, fails with `Failed to join new user: AssertionError()`
```

### Anything else that would be useful to know?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by comparing the linked success and failure logs, then trace the auto-join handling reported from synapse.handlers.register. Reproduce the configuration change from the issue and determine why newly registered users fail to join the updated aliases; done means changing auto_join_rooms works without starting from a fresh server.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.