element-hq / element-hq/synapse
Non-image media does not load and times out under certain conditions
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
### Description
When using Element X iOS, there is a set of specific conditions under which media will not load and will time out after 30 seconds. I was informed that it was indicated via the following Element X logs that it does not appear to be an issue with the app:
`matrix_sdk::http_client: Error while sending request: Reqwest(reqwest::Error { kind: Body, source: TimedOut }) | crates/matrix-sdk/src/http_client/mod.rs:234 | spans: send{server_versions=[V1_0, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 30s, retry_limit: 0 } request_id="REQ-40" method=GET uri="https://homeserver.address/_matrix/client/v1/media/thumbnail/homeserver.address/smfWrihLzCeGAyhtHkGKTTKD"} 2024-12-07T08:29:13.455924Z ERROR elementx: Failed retrieving image with error: Generic(msg: "request or response body error") | MediaProvider.swift:64 | spans: root`
### Steps to reproduce
The steps are somewhat complicated. However, I asked another Element X iOS user to reproduce it for me and they encountered the same issue, so a tester from the dev team probably could as well. It requires a Mullvad VPN account.
- On Mullvad VPN iOS, go to VPN settings and 1) enable multi-hop, 2) set wireguard obfuscation to UDP-over-TCP, and 3) set quantum-resistant tunnel to on
- set the entry server to a certain Houston US server, us-hou-wg-001 (the specific server apparently matters, at least for the exit, but might as well choose the same one we did for the entry as well)
- set the exit server specifically to this Netherlands server: nl-ams-wg-001 (the issue also happens for 002, 003, and 004)
- send yourself a new audio or video file in a private channel (happens in both encrypted or unencrypted) (must be a new file not previously loaded and cached)
- will get loading icon for 30 seconds and then timeout
Images appear to load normally.
### Homeserver
Another homeserver
### Synapse Version
1.120.2
### Installation Method
Other (please mention below)
### Database
PostgreSQL
### Workers
Multiple workers
### Platform
Ubuntu 22.04, no VM
### Relevant log output
```shell
Unsure of relevant portion
```
### Anything else that would be useful to know?
- Authenticated media enabled
- Native sliding sync
- On such VPN servers, the connection is generally fast and all other server functionality works normally, including loading images. This specifically happens for files like mp3 or webm
- The files attempting to be loaded are small (as little as under 1MB)
- I have not confirmed that such complex VPN configuration is necessary to reproduce the bug, so it might happen for a broader scope of users than the criteria would indicate; I have unintentionally replicated the bug multiple times in the past on different Mullvad servers but did not report it those times
- **Can download all media properly with such VPN configuration on Element iOS; does Element X have some specific interaction with the server? If not, would this question be better-suited for Element X devs after all?**
Contributor guide
Assessment
This issue has not been assessed yet.