element-hq / element-hq/synapse
When a worker cannot connect to another the log messages are unhelpful
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#16303](https://github.com/matrix-org/synapse/issues/16303).
---
### Description
Media worker tried to connect a wrong IP for federation sender.
The log contained various crazy stuff:
- remote server refused connection
- remote server gave 502 error (bad gateway)
Even enabled DEBUG didn't reveal anything obvious. Lot of stracing and tcpdumps revealed that media worker wanted to connect a wrong IP, which in turn made me find the only hint the log contained, which is
```
2023-09-11 22:19:45,884 - synapse.http.proxyagent - 313 - DEBUG - GET-42- Requesting matrix-federation://norge.chat/_matrix/media/r0/download/norge.chat/FWVlbNUArgokLhAMRyhvEDON?allow_remote=false via <_RandomSampleEndpoints endpoints=[, ]>
```
Fixing the ip resolved the problem, but the log have not helped at all. Neither told the real problem nor was it revealing that it has logged fake errors if they were given from the remote server and not our own worker [replication] connection.
### Steps to reproduce
- use bad ip for federation sender worker in the config of the media worker
- try to retrieve media
- observe the lack of real errors and plenty of fake ones
### Homeserver
grin.hu
### Synapse Version
1.90.0-1
### Installation Method
Other (please mention below)
### Database
psql
### Workers
Multiple workers
### Platform
Debian/bookworm. Installed from debian pkg, not that it matters.
### Configuration
N/A
### Relevant log output
```shell
2023-09-11 18:02:57,960 - synapse.http.matrixfederationclient - 758 - INFO - GET-19848- {GET-O-6479} [infeeeee.duckdns.org] Request failed: GET matrix-federation://infeeeee.duckdns.org/_matrix/media/r0/download/infeeeee.duckdns.org/PuraUIczWXOjSUBjeTQJwPpf?allow_remote=false: ConnectionRefusedError('Connection refused')
2023-09-11 18:40:33,325 - synapse.http.server - 118 - INFO - GET-19962- SynapseError: 502 - Failed to fetch remote media
```
### Anything else that would be useful to know?
I don't think so.
Contributor guide
Assessment
This issue has not been assessed yet.