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

"twisted.internet.error.ConnectError" when using IPv6 literal as smtp hostname #11839

Closed
jaywink opened this issue Jan 26, 2022 · 3 comments
Closed

Comments

@jaywink
Copy link
Member

jaywink commented Jan 26, 2022

Description

Tried configuring SMTP with an ipv6 literal. Telnet to the ipv6 address with port 25 works fine. Setting this as smtp host in Synapse with the right port makes email sending raise an error.

Steps to reproduce

Set an ipv6 literal as email.smtp_host.

Following stacktrace happens:

2022-01-26 21:04:10,299 - synapse.handlers.send_email - 178 - INFO - POST-14 - Sending email to [email protected]
2022-01-26 21:04:10,306 - twisted - 279 - INFO - sentinel - SMTP Client retrying server. Retry: 5
2022-01-26 21:04:10,306 - twisted - 279 - INFO - sentinel - SMTP Client retrying server. Retry: 4
2022-01-26 21:04:10,306 - twisted - 279 - INFO - sentinel - SMTP Client retrying server. Retry: 3
2022-01-26 21:04:10,307 - twisted - 279 - INFO - sentinel - SMTP Client retrying server. Retry: 2
2022-01-26 21:04:10,307 - twisted - 279 - INFO - sentinel - SMTP Client retrying server. Retry: 1
2022-01-26 21:04:10,308 - synapse.handlers.identity - 414 - ERROR - POST-14 - Error sending threepid validation email to [email protected]
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/identity.py", line 412, in send_threepid_validation
    await send_email_func(email_address, token, client_secret, session_id)
  File "/usr/local/lib/python3.8/site-packages/synapse/push/mailer.py", line 209, in send_add_threepid_mail
    await self.send_email(
  File "/usr/local/lib/python3.8/site-packages/synapse/push/mailer.py", line 324, in send_email
    await self.send_email_handler.send_email(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/send_email.py", line 180, in send_email
    await self._sendmail(
  File "/usr/local/lib/python3.8/site-packages/synapse/handlers/send_email.py", line 116, in _sendmail
    await make_deferred_yieldable(d)
twisted.internet.error.ConnectError: An error occurred while connecting: 99: Cannot assign requested address.
2022-01-26 21:04:10,309 - synapse.http.server - 95 - INFO - POST-14 - <XForwardedForRequest at 0x7f969a9dd400 method='POST' uri='/_matrix/client/r0/account/3pid/email/requestToken' clientproto='HTTP/1.0' site='8008'> SynapseError: 500 - An error was encountered when sending the email
2022-01-26 21:04:10,310 - synapse.access.http.8008 - 424 - INFO - POST-14 - 172.18.0.2 - 8008 - {None} Processed request: 0.022sec/0.000sec (0.009sec, 0.001sec) (0.001sec/0.005sec/2) 94B 500 "POST /_matrix/client/r0/account/3pid/email/requestToken HTTP/1.0" "Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0" [0 dbevts]

Tried then to set a hostname for the ipv6 address in /etc/hosts but that causes DNSLookupError EDIT: ignore this error, I didn't do it in the container 🤦 Will need to try that workaround.

Version information

  • Homeserver: Self-hosted private homeserver

  • Version: v1.51.0

  • Install method: Official Docker images

  • Platform: Docker 20.10 on Debian 10.9

@clokep
Copy link
Member

clokep commented Jan 26, 2022

Maybe of a duplicate of #7720?

@richvdh
Copy link
Member

richvdh commented Jan 27, 2022

sounds like a dup. closing unless other info comes to light!

@richvdh richvdh closed this as completed Jan 27, 2022
@jaywink
Copy link
Member Author

jaywink commented Jan 27, 2022

This ended up being a networking problem outside Synapse, the docker container didn't even have ipv6 networking 🤦 . Sorry for the noise.

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

3 participants