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

Workers fail to talk to main synapse when configured with IPv6 address in URL #4478

Closed
silkeh opened this issue Jan 25, 2019 · 1 comment
Closed

Comments

@silkeh
Copy link
Contributor

silkeh commented Jan 25, 2019

Description

Using an IPv6 address in the worker_main_http_uri produces an exception.
This seems to be similar to the problem encountered in #4092.
Example:

2019-01-01 13:51:26,108 - synapse.http.server - 112 - ERROR - POST-1- Failed handle request via <function JsonResource._async_render at 0x7f82052f7510>: <SynapseRequest at 0x7f8203ea2828 method='POST' uri='/_matrix/client/unstable/keys/upload/HJSGVBHQYD' clientproto='HTTP/1.1' site=8090>: Traceback (most recent call last):
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/client.py", line 199, in post_json_get_json
    data=json_str
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/server.py", line 81, in wrapped_request_handler
    yield h(self, request)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/server.py", line 316, in _async_render
    callback_return = yield callback(request, **kwargs)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/app/frontend_proxy.py", line 130, in on_POST
    headers=headers,
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/client.py", line 199, in post_json_get_json
    data=json_str
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/synapse/http/client.py", line 100, in request
    method, uri, agent=self.agent, data=data, headers=headers
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/treq/api.py", line 113, in request
    return _client(**kwargs).request(method, url, **kwargs)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/treq/client.py", line 157, in request
    url = URL.fromText(url).asURI().asText().encode('ascii')
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/hyperlink/_url.py", line 1338, in to_uri
    new_host = self.host if not self.host else idna_encode(self.host, uts46=True).decode("ascii")
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/idna/core.py", line 358, in encode
    s = alabel(label)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/idna/core.py", line 270, in alabel
    ulabel(label)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/idna/core.py", line 304, in ulabel
    check_label(label)
  File "/opt/venvs/matrix-synapse/lib/python3.5/site-packages/idna/core.py", line 261, in check_label
    raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label)))
idna.core.InvalidCodepoint: Codepoint U+003A at position 1 of '::1' not allowed

Steps to reproduce

  1. Install matrix-synapse-py3.
  2. Configure the replication listeners with bind_address: "::1"
  3. Configure a worker with worker_main_http_uri: "http://[::1]:8008"
  4. Start synapse.

The above error will be encountered.

These URLs are valid, and expected to work.

Version information

  • Homeserver: slxh.eu
  • Version: 0.34.1.1++1+stretch1

  • Install method: Debian package from matrix.org repo

  • Platform: Debian Linux

This only happens with the Python3 package. The Python2 package is unaffected.
A workaround is using ip6-localhost in the URL.

@clokep
Copy link
Member

clokep commented Aug 18, 2020

I think this is a duplicate of #7695.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants