This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Unexplained KeyError 'destination_is'
#12690
Copy link
Copy link
Closed
Labels
P4(OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches(OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patchesS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Description
Internal users: https://sentry.matrix.org/sentry/synapse-matrixorg/issues/247960/?query=is%3Aunresolved%20destination_is
StopIteration: DestinationRetryTimings(failure_ts=1568794598907, retry_last_ts=1591706354703, retry_interval=126355483270)
File "twisted/internet/defer.py", line 1660, in _inlineCallbacks
result = current_context.run(gen.send, result)
StopIteration: DestinationRetryTimings(failure_ts=1568794598907, retry_last_ts=1591706354703, retry_interval=126355483270)
File "twisted/internet/defer.py", line 1660, in _inlineCallbacks
result = current_context.run(gen.send, result)
KeyError: 'destination_is'
File "synapse/http/server.py", line 298, in _async_render_wrapper
callback_return = await self._async_render(request)
File "synapse/http/server.py", line 500, in _async_render
callback_return = await raw_callback_return
File "synapse/rest/client/directory.py", line 57, in on_GET
res = await self.directory_handler.get_association(room_alias_obj)
File "synapse/handlers/directory.py", line 257, in get_association
ignore_backoff=True,
File "synapse/federation/federation_client.py", line 184, in make_query
ignore_backoff=ignore_backoff,
File "synapse/federation/transport/client.py", line 272, in make_query
ignore_backoff=ignore_backoff,
File "synapse/http/matrixfederationclient.py", line 1068, in get_json
timeout=timeout,
File "synapse/http/matrixfederationclient.py", line 389, in _send_request_with_optional_trailing_slash
response = await self._send_request(request, **send_request_args)
File "synapse/http/matrixfederationclient.py", line 540, in _send_request
destination_bytes, method_bytes, url_to_sign_bytes
File "synapse/http/matrixfederationclient.py", line 748, in build_auth_headers
request.get("destination") or request["destination_is"],
synapse/synapse/http/matrixfederationclient.py
Lines 695 to 752 in 8dd3e0e
def build_auth_headers( | |
self, | |
destination: Optional[bytes], | |
method: bytes, | |
url_bytes: bytes, | |
content: Optional[JsonDict] = None, | |
destination_is: Optional[bytes] = None, | |
) -> List[bytes]: | |
""" | |
Builds the Authorization headers for a federation request | |
Args: | |
destination: The destination homeserver of the request. | |
May be None if the destination is an identity server, in which case | |
destination_is must be non-None. | |
method: The HTTP method of the request | |
url_bytes: The URI path of the request | |
content: The body of the request | |
destination_is: As 'destination', but if the destination is an | |
identity server | |
Returns: | |
A list of headers to be added as "Authorization:" headers | |
""" | |
if destination is None and destination_is is None: | |
raise ValueError("destination and destination_is cannot both be None!") | |
request: JsonDict = { | |
"method": method.decode("ascii"), | |
"uri": url_bytes.decode("ascii"), | |
"origin": self.server_name, | |
} | |
if destination is not None: | |
request["destination"] = destination.decode("ascii") | |
if destination_is is not None: | |
request["destination_is"] = destination_is.decode("ascii") | |
if content is not None: | |
request["content"] = content | |
request = sign_json(request, self.server_name, self.signing_key) | |
auth_headers = [] | |
for key, sig in request["signatures"][self.server_name].items(): | |
auth_headers.append( | |
( | |
'X-Matrix origin=%s,key="%s",sig="%s",destination="%s"' | |
% ( | |
self.server_name, | |
key, | |
sig, | |
request.get("destination") or request["destination_is"], | |
) | |
).encode("ascii") | |
) | |
return auth_headers |
There's logic which is trying to assert we've provided sensible input, but it's failing. I'd guess that destination
is an empty bytes
object?
Metadata
Metadata
Assignees
Labels
P4(OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches(OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patchesS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.