element-hq / element-hq/synapse
`register_new_matrix_user` can't deal with unix socket listeners
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#16390](https://github.com/matrix-org/synapse/issues/16390).
---
### Description
I have configured an unix-socket as a listener in homeserver.yaml, without listening on ports, on a newly configured synapse instance.
This way, `register_new_matrix_user` crashes.
### Steps to reproduce
- setup only unix socket listener with `path`
- use `sudo -u synapse -- register_new_matrix_user -c [config path] --admin`
- observe crash
### Homeserver
self-hosted synapse
### Synapse Version
1.92.1
### Installation Method
Other (please mention below)
### Database
single pgsql 15.4, fresh setup
### Workers
Single process
### Platform
archlinux arm
### Configuration
```yaml
listeners:
- path: /run/synapse/homeserver.sock
mode: 660
type: http
resources:
- names: [client, federation]
```
### Relevant log output
```shell
not relevant
```
### Anything else that would be useful to know?
Error Traceback:
```python
Traceback (most recent call last):
File "/usr/bin/register_new_matrix_user", line 8, in
sys.exit(main())
^^^^^^
File "/usr/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 247, in main
server_url = _find_client_listener(config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/synapse/_scripts/register_new_matrix_user.py", line 309, in _find_client_listener
return f"http://localhost:{listener['port']}"
~~~~~~~~^^^^^^^^
KeyError: 'port'
```
Contributor guide
Research direction
Start in synapse/_scripts/register_new_matrix_user.py, especially main() and _find_client_listener(), and reproduce the command with a homeserver.yaml containing only the Unix-socket listener shown here. Trace how the listener is selected and verify that registration completes without the reported KeyError when no port is configured.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100