aiosmtpd: RuntimeError after upgrading from 1.2.2
After upgrading from version 1.2.2 to 1.2.4 we receive the following error when trying to start the controller:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/site-packages/aiosmtpd/controller.py", line 165, in start
raise RuntimeError("Unknown Error, failed to init SMTP server")
RuntimeError: Unknown Error, failed to init SMTP server
This error can even be triggered by running the sample code from the documentation:
import asyncio
class ExampleHandler:
async def handle_RCPT(self, server, session, envelope, address, rcpt_options):
return '250 OK'
from aiosmtpd.controller import Controller
controller = Controller(ExampleHandler())
controller.start()
After executing “controller.start()” the RuntimeError from above appears.
Python version is 3.6.8 OS is Red Hat 7.9 aiosmtpd was installed with pip3. After downgrading via “sudo pip3 install aiosmtpd=1.2.2” everything works again and aiosmtpd receives and processes emails without problems.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 32
Commits related to this issue
- Test newly-implemented TimeoutError Inspired by #244 — committed to pepoluan/aiosmtpd by pepoluan 3 years ago
- Wait until factory _is_ invoked Also inspired by #244 We add another threading.Event to wait until _factory_invoker() completes. Plus a test case to test this timeout. — committed to pepoluan/aiosmtpd by pepoluan 3 years ago
- Pin aiosmtpd to latest working version Version higher than 1.2.2 cause the server start to fail. See https://github.com/aio-libs/aiosmtpd/issues/244 for more info. — committed to LeoVerto/email2signal by LeoVerto 3 years ago
- Fix Controller Bug on hostname="" or IPv6 not available (PR #248, Issue #244) * Implement _factory_invoked Event * Suppress only socket.timeout exception Other exceptions should bubble up, no lon... — committed to aio-libs/aiosmtpd by pepoluan 3 years ago
Hi, sure. I was thinking it can be similar one 😃 New one opened.
This has fixed the issue for me, thank you so much for the quick debugging and fix, @pepoluan!
Hello @pepoluan thank you very much! Looks very good, except that on my system the error 97 is thrown:
Errno 97 translates to errno.EAFNOSUPPORT, however get_localhost() is catching errno.EADDRNOTAVAIL. If I replace errno.EADDRNOTAVAIL with errno.EAFNOSUPPORT, version 1.3.1 works!
v1.3.1 is marinating, to be released tomorrow.
Definitely will fix @LeoVerto 's issue.
Not sure if it will fix @gnugnug 's issue, but at least 1.3.1 has more control points that can give more visibility into what’s going on.
Hey, someone else here!
I’ve been getting this issue with Python 3.9 in both alpine-based docker images and on my dev machine running Arch Linux, in both cases using a fresh virtualenv created by pipenv.
To reproduce this, clone my repository at this commit and replace line 90 in app.py with
config = {}
to avoid having to set all the config environment variables. Next runpipenv install
and finallypipenv run python app.py
to start the application.