element-hq / element-hq/synapse
Media api failure over unix socket: AttributeError: 'UNIXAddress' object has no attribute 'host'
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
When switching a working configuration to use unix sockets, the listeners for the media API breaks (no images/profile pictures etc load).
### Steps to reproduce
- take known good configuration
- replace `port` and `bind_addresses` with `path` to unix socket
- route through nginx reverse proxy (`proxyPass: "http://unix:/path/to/unix.socket"`
- observe messages generally working but media being broken
### Homeserver
zimward.moe
### Synapse Version
1.138.0
### Installation Method
Other (please mention below)
### Database
PostgreSQL, non ported, non restored, single server
### Workers
Single process
### Platform
- system: `"aarch64-linux"`
- host os: `Linux 6.12.47, NixOS, 25.11 (Xantusia), 25.11.20250918.971d10c`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.28.5`
- channels(root): `"nixos"`
- nixpkgs: `/nix/store/sanhljbdmv6kcyhzab7gj14zqzr7xwlf-source`
### Configuration
```
app_service_config_files: []
database:
args:
database: matrix-synapse
user: matrix-synapse
name: psycopg2
dynamic_thumbnails: false
enable_metrics: false
enable_registration: false
extraConfig: 'max_upload_size: "100M"
'
instance_map: {}
listeners:
- mode: 432
path: /run/matrix-synapse/matrix-synapse.sock
resources:
- compress: false
names:
- client
- federation
type: http
x_forwarded: true
- bind_addresses:
- ::1
port: 8008
resources:
- compress: false
names:
- client
tls: false
type: http
x_forwarded: false
log_config: /nix/store/7b8a7m13n8prjsxwzp9r66msm9bnwb1k-log_config
max_image_pixels: 32M
max_upload_size: 50M
media_retention:
remote_media_lifetime: 30d
media_store_path: /nix/persist/system/matrix-synapse//media_store
pid_file: /run/matrix-synapse.pid
presence:
enabled: true
public_baseurl: https://zimward.moe
redis:
enabled: false
registration_shared_secret: REDACTED
report_stats: false
server_name: zimward.moe
signing_key_path: /nix/persist/system/matrix-synapse//homeserver.signing.key
trusted_key_servers:
- server_name: matrix.org
verify_keys:
ed25519:auto: Noi6WqcDj0QmPxCNQqgezwTlBKrfqehY1u2FyWP9uYw
turn_allow_guests: true
turn_shared_secret: REDACTED
turn_uris:
- turn:matrix.zimward.moe:3478?transport=udp
- turn:matrix.zimward.moe:3478?transport=tcp
turn_user_lifetime: 1h
url_preview_enabled: true
url_preview_ip_range_blacklist:
- 10.0.0.0/8
- 100.64.0.0/10
- 127.0.0.0/8
- 169.254.0.0/16
- 172.16.0.0/12
- 192.0.0.0/24
- 192.0.2.0/24
- 192.168.0.0/16
- 192.88.99.0/24
- 198.18.0.0/15
- 198.51.100.0/24
- 2001:db8::/32
- 203.0.113.0/24
- 224.0.0.0/4
- ::1/128
- fc00::/7
- fe80::/10
- fec0::/10
- ff00::/8
url_preview_ip_range_whitelist: []
url_preview_url_blacklist: []
```
switching back to use TCP/IP as listener fixes the broken media api
### Relevant log output
```shell
synapse.http.server: [GET-6988] Failed handle request via 'ThumbnailResource':
Traceback (most recent call last):
File "/nix/store/gnzhv1i13mca9bx710x3lq090f2bmkja-matrix-synapse-1.138.0/lib/python3.13/site-packages/synapse/http/server.py", line 337, in _async_render_wrapper
callback_return = await self._async_render(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/gnzhv1i13mca9bx710x3lq090f2bmkja-matrix-synapse-1.138.0/lib/python3.13/site-packages/synapse/http/server.py", line 562, in _async_render
callback_return = await raw_callback_return
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/gnzhv1i13mca9bx710x3lq090f2bmkja-matrix-synapse-1.138.0/lib/python3.13/site-packages/synapse/rest/client/media.py", line 195, in on_GET
ip_address = request.getClientAddress().host
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'UNIXAddress' object has no attribute 'host'
```
### Anything else that would be useful to know?
the error appears on every media request from what i can tell.
Contributor guide
Assessment
This issue has not been assessed yet.