element-hq / element-hq/synapse
502 error when looking up room alias from dead homeserver
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
Looking up a room alias hosted by a dead homeserver returns a 502 error.
This causes a CORS error for clients running in web browser, so eg. Element Web hangs.
### Steps to reproduce
```shell
$ curl 'https://matrix-client.matrix.org/_matrix/client/v3/directory/room/%23nonexistentroom%3Alibera.chat' -i
HTTP/2 502
date: Thu, 15 Feb 2024 23:35:59 GMT
content-type: text/plain; charset=UTF-8
content-length: 15
x-frame-options: SAMEORIGIN
referrer-policy: same-origin
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
server: cloudflare
cf-ray: 85615ed20cfcd676-CDG
error code: 502
```
### Homeserver
matrix.org
### Synapse Version
1.101.0 (b=matrix-org-hotfixes,6dbedcf601)
### Installation Method
Docker (matrixdotorg/synapse)
### Database
postgresql
### Workers
Multiple workers
### Platform
n/a
### Configuration
_No response_
### Relevant log output
```shell
n/a
```
### Anything else that would be useful to know?
_No response_
Contributor guide
Research direction
Start by reproducing the room-alias lookup with the curl request in the issue and trace the Synapse endpoint handling a dead homeserver. Identify where the upstream failure becomes a 502, then verify that the response is handled correctly for browser clients without the reported CORS failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100