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

Confusing error when Synapse fails to connect to a domain due to it being on the blacklist #10224

Open
erikjohnston opened this issue Jun 21, 2021 · 3 comments
Labels
S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@erikjohnston
Copy link
Member

c.f. #9475 etc.

Basically when this happens the following stack trace is produced in the logs:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/synapse/http/server.py", line 252, in _async_render_wrapper
    callback_return = await self._async_render(request)
  File "/usr/local/lib/python3.8/site-packages/synapse/http/server.py", line 430, in _async_render
    callback_return = await raw_callback_return
  File "/usr/local/lib/python3.8/site-packages/synapse/rest/client/v1/room.py", line 734, in on_POST
    await self.room_member_handler.do_3pid_invite(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/room_member.py", line 879, in do_3pid_invite
    stream_id = await self._make_and_store_3pid_invite(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/room_member.py", line 941, in _make_and_store_3pid_invite
    ) = await self.identity_handler.ask_id_server_for_third_party_invite(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/identity.py", line 856, in ask_id_server_for_third_party_invite
    data = await self.blacklisting_http_client.post_json_get_json(
  File "/usr/local/lib/python3.8/site-packages/synapse/http/client.py", line 530, in post_json_get_json
    response = await self.request(
  File "/usr/local/lib/python3.8/site-packages/synapse/http/client.py", line 422, in request
    response = await make_deferred_yieldable(request_deferred)
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/local/lib/python3.8/site-packages/twisted/internet/endpoints.py", line 981, in startConnectionAttempts
    raise error.DNSLookupError(
twisted.internet.error.DNSLookupError: DNS lookup failed: no results for hostname lookup: matrix.nilsson.link.

which is very misleading when what is actually happening is the host is being resolved to a private IP which then gets blacklisted (as private IPs are in the blacklist by default).

We do log Dropped %s from DNS resolution to %s due to blacklist when this happens, which is better than nothing, but is easily missed if it's happening several lines above the error in the logs.

Ideally we'd somehow make the error message in the stack trace more helpful.

@erikjohnston erikjohnston added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Jun 21, 2021
@richvdh
Copy link
Member

richvdh commented Jun 21, 2021

I think doing #8860 would fix this.

@richvdh
Copy link
Member

richvdh commented Jun 24, 2021

We're hoping that #10115 will mean that people are a bit less likely to run into this.

@richvdh richvdh changed the title Add better diagnostics when Synapse fails to connect to a domain due to it being on the blacklist Confusing error when Synapse fails to connect to a domain due to it being on the blacklist Jun 24, 2021
@richvdh richvdh added T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. and removed T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Jun 24, 2021
@richvdh
Copy link
Member

richvdh commented Nov 30, 2021

vaguely related: #8917

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
S-Tolerable Minor significance, cosmetic issues, low or no impact to users. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

2 participants