matrix-org / matrix-org/matrix-spec
Cleaning up dead servers
- Dominant language
- HTML
- Stars
- 330
- Forks
- 150
- Avg merge
- 2h 21m
- Merged PRs (30d)
- 3
Description
I just joined `#social:matrix.org`, and tried to have a look at synapse's logs while it was painfully trying to join.
Basically, what I saw most often was messages like these (repeated):
```
synapse.http.matrixfederationclient: [] {PUT-O-120641} Sending request failed to 4ray.co: PUT matrix://4ray.co/_matrix/federation/v1/send/1522796890812/: ConnectionRefusedError('Connection refused',)
synapse.http.matrixfederationclient: [] {PUT-O-121051} Sending request failed to jomo.tv: PUT matrix://jomo.tv/_matrix/federation/v1/send/1522796891206/: NoRouteError('Network is unreachable',)
synapse.http.matrixfederationclient: [] {PUT-O-121337} Sending request failed to thebeckmeyers.xyz: PUT matrix://thebeckmeyers.xyz/_matrix/federation/v1/send/1522796891492/: TimeoutError('',)
synapse.http.matrixfederationclient: [] {PUT-O-120644} Sending request failed to matrix.home.ansorg-web.de: PUT matrix://matrix.home.ansorg-web.de/_matrix/federation/v1/send/1522796890815/: DNSLookupError('no results for hostname lookup: matrix.home.ansorg-web.de',)
[a python stacktrace for BadSignatureError: Signature was forged or corrupt]
synapse.federation.federation_base: [GET-426682] Signature check failed for $15000398313789kDXuE:half-shot.uk
```
So all these messages have something in common: they relate to servers that appear to no longer be alive.
I don't think Matrix currently has any way of saying “this server is really dead, so let's just force-part all its users and forget about it”. I think (without having measured, again), that this kind of waiting for a big number of timeouts may be one of the things that's slowing joining a big room.
Maybe it would be reasonable to say that after all the servers currently alive in a room have seen a server for the last time 3 months ago (number to adjust, but 3 months seems enough to avoid catching accidental downtime to me), then the server is declared dead.
Dead servers would be marked as such, and no signature checking attempt would be tried for them (as another server could come in after that and re-buy the domain name), newly joining servers would be warned not to try to contact them, etc.
Does what I'm saying make sense? I'm basically thinking that:
1. exponential backoff is nice but won't help for newly-joining servers
2. at some point a server could just die and the DNS be re-bought, and then we don't want to come back a year later and assume the new owner is the same as the previous one
What do you think about it?
Contributor guide
Research direction
Start by reviewing the proposed dead-server handling and its effects on federation, signature checking, joining large rooms, and DNS reuse. Done would require an agreed protocol design and a precise specification of server liveness, expiry, and behavior for existing and newly joining servers.
Written by the indexing model from the issue text.
Assessment
- Domain
- distributed-systems, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100