Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

room alias lookups on libera.chat timing out #14462

Open
progval opened this issue Nov 16, 2022 · 8 comments
Open

room alias lookups on libera.chat timing out #14462

progval opened this issue Nov 16, 2022 · 8 comments
Labels
A-Federated-Join joins over federation generally suck good first issue Good for newcomers O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution

Comments

@progval
Copy link
Contributor

progval commented Nov 16, 2022

Description

I created a room yesterday, and no client can display it because getting client/v3/directory/room/ times out or crashes with a 502 error.

With curl:

$ curl https://matrix.org/_matrix/client/v3/directory/room/%23valtest8:libera.chat
{"errcode":"M_UNKNOWN","error":"Failed to fetch alias"}

With my own client, the connection times out

And from my browser (regardless of being logged in), I'm getting Cloudflare's 502 Bad Gateway page

Steps to reproduce

  • join a room on a different server, with no other user from your own homeserver in the room
  • leave and re-join a couple of times
  • Eventually the client will be stuck

Homeserver

matrix.org

Synapse Version

1.71.0rc2 (b=matrix-org-hotfixes,39ea774cff,dirty)

Installation Method

No response

Platform

n/a

Relevant log output

n/a

Anything else that would be useful to know?

No response

@DMRobertson
Copy link
Contributor

Homeserver
matrix.org

"Failed to fetch alias"

matrix.org is contacting libera.chat and asking it to resolve your alias. We are either failing to send the request or we got an error response from libera.chat.

try:
fed_result: Optional[JsonDict] = await self.federation.make_query(
destination=room_alias.domain,
query_type="directory",
args={"room_alias": room_alias.to_string()},
retry_on_dns_fail=False,
ignore_backoff=True,
)
except RequestSendFailed:
raise SynapseError(502, "Failed to fetch alias")
except CodeMessageException as e:
logging.warning("Error retrieving alias")
if e.code == 404:
fed_result = None
else:
raise SynapseError(502, "Failed to fetch alias")

I suggest using an account on libera.chat to see if it is able to resolve the alias.

@DMRobertson DMRobertson added the X-Needs-Info This issue is blocked awaiting information from the reporter label Nov 16, 2022
@progval
Copy link
Contributor Author

progval commented Nov 16, 2022

libera.chat does not support Matrix accounts; but this request works:

$ curl https://libera.ems.host/_matrix/client/v3/directory/room/%23valtest8:libera.chat
{"room_id":"!xTdZsDoDGxqNTiMEbo:libera.chat","servers":["libera.chat","matrix.org"]}

EDIT: and over federation:

=========================================================================================
libera.chat GET https://libera.ems.host/_matrix/federation/v1/query/directory?room_alias=%23valtest8%3Alibera.chat
-----------------------------------------------------------------------------------------
200
{"room_id": "!xTdZsDoDGxqNTiMEbo:libera.chat", "servers": ["libera.chat"]}
=========================================================================================

@DMRobertson
Copy link
Contributor

Matrix.org is making a similar request but not getting a response:

var/homeserver.log:2022-11-16 12:40:20,307 - synapse.http.matrixfederationclient - 672 - INFO - GET-76b04b285e9d71fe-LHR- - {GET-O-3015328} [libera.chat] Request failed: GET matrix://libera.chat/_matrix/federation/v1/query/directory?room_alias=%23valtest8%3Alibera.chat: ResponseNeverReceived:[CancelledError()]
var/homeserver.log:2022-11-16 12:40:20,307 - synapse.http.server - 108 - INFO - GET-76b04b285e9d71fe-LHR - <XForwardedForRequest at 0x7f6c060c9190 method='GET' uri='/_matrix/client/v3/directory/room/%23valtest8:libera.chat' clientproto='HTTP/1.1' site='8080'> SynapseError: 502 - Failed to fetch alias
var/homeserver.log:2022-11-16 12:40:20,308 - synapse.access.http.8080 - 460 - INFO - GET-76b04b285e9d71fe-LHR - 81.101.238.199 - 8080 - {None} Processed request: 10.004sec/0.001sec (0.000sec, 0.000sec) (0.000sec/0.000sec/0) 55B 502 "GET /_matrix/client/v3/directory/room/%23valtest8:libera.chat HTTP/1.1" "curl/7.82.0" [0 dbevts]

@clokep clokep changed the title Crash in GET client/v3/directory/room/ client/v3/directory/room/ request to liber.chat failing with 504 error Nov 16, 2022
@progval
Copy link
Contributor Author

progval commented Nov 16, 2022

@clokep federation/v1/query/directory is the one failing on libera.chat

@clokep clokep changed the title client/v3/directory/room/ request to liber.chat failing with 504 error client/v3/directory/room/ request to libera.chat failing with 504 error Nov 16, 2022
@progval progval changed the title client/v3/directory/room/ request to libera.chat failing with 504 error federation/v1/query/directory/ request to libera.chat failing with 504 error Nov 16, 2022
@richvdh richvdh removed the X-Needs-Info This issue is blocked awaiting information from the reporter label Nov 17, 2022
@richvdh richvdh changed the title federation/v1/query/directory/ request to libera.chat failing with 504 error room alias lookups on libera.chat timing out Nov 17, 2022
@richvdh
Copy link
Member

richvdh commented Nov 17, 2022

There seems to be something a bit wrong with libera.chat. I have opened #14480 to track.

@DMRobertson DMRobertson added the T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. label Nov 22, 2022
@DMRobertson
Copy link
Contributor

DMRobertson commented Nov 22, 2022

Is there anything better we can do here? The only thing I can think of is a better error message to emphasise that make it clear that the problem lies with libera.chat is, e.g. Failed to lookup #valtest8:libera.chat from libera.chat.

Edit: there doesn't seem to be a particularly useful error code defined in the spec.

@DMRobertson DMRobertson added A-Federated-Join joins over federation generally suck S-Tolerable Minor significance, cosmetic issues, low or no impact to users. O-Occasional Affects or can be seen by some users regularly or most users rarely Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution good first issue Good for newcomers labels Nov 22, 2022
@DMRobertson
Copy link
Contributor

If anyone wants to take this on, the error strings seem to come from

except RequestSendFailed:
raise SynapseError(502, "Failed to fetch alias")
except CodeMessageException as e:
logging.warning("Error retrieving alias")
if e.code == 404:
fed_result = None
else:
raise SynapseError(502, "Failed to fetch alias")

@DMRobertson
Copy link
Contributor

(curl https://matrix.org/_matrix/client/v3/directory/room/%23valtest8:libera.chat is currently working. Presumably libera.chat is happier these days.)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Federated-Join joins over federation generally suck good first issue Good for newcomers O-Occasional Affects or can be seen by some users regularly or most users rarely S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution
Projects
None yet
Development

No branches or pull requests

3 participants