upgrading in FreeBSD 13.1-p7: problem with aiosmtpd and lmtp runner
As you could have read yesterday, I had problems upgrading to the last versions of mailman3 related apps. The lmtp runner stopped after upgrade and showed and error in aiosmtpd package.
the O.S. version running may servers is FreeBSD 13.1-p7
That was in a mailman3 server with few lists and traffic. O did the upgrade today in the server that has many lists and hard traffic. When I restarted mailman it showed this trace:
Generating MTA alias maps /usr/local/mailman3 # Traceback (most recent call last): File "/usr/local/bin/runner", line 33, in <module> sys.exit(load_entry_point('mailman==3.3.8', 'console_scripts', 'runner')()) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/mailman/bin/runner.py", line 184, in main runner = make_runner(*runner_spec, once=once) File "/usr/local/lib/python3.9/site-packages/mailman/bin/runner.py", line 70, in make_runner return runner_class(name, slice) File "/usr/local/lib/python3.9/site-packages/mailman/runners/lmtp.py", line 295, in __init__ self.lmtp = LMTPController(LMTPHandler(), hostname=hostname, port=port) File "/usr/local/lib/python3.9/site-packages/aiosmtpd/controller.py", line 417, in __init__ self._localhost = get_localhost() File "/usr/local/lib/python3.9/site-packages/aiosmtpd/controller.py", line 66, in get_localhost with makesock(AF_INET6, SOCK_STREAM) as sock: File "/usr/local/lib/python3.9/socket.py", line 232, in __init__ _socket.socket.__init__(self, family, type, proto, fileno) OSError: [Errno 43] Protocol not supported
As Mark pointed it can be circunverted modifying /PATH_TO_YOUR_PYTHON/site-packages/aiosmtpd/controller.py and changing the 49th line as this:
# Helper function to assist in mocking^M ## return has_ipv6^M return False
After that, restarting mailman 3 works perfectly.
It seems that FreeBSD is handling IPv6 in a way that other OSs dont. It surprise me, because FreeBSD was the first OS where IPv6 was deployed, but it is what it is.
Thaks to everybody for your patience, specially Odhiambo and Mark.
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
On Sun, Apr 2, 2023 at 11:35 AM Guillermo Hernandez (Oldno7) via Mailman-users <mailman-users@mailman3.org> wrote:
As you could have read yesterday, I had problems upgrading to the last versions of mailman3 related apps. The lmtp runner stopped after upgrade and showed and error in aiosmtpd package.
the O.S. version running may servers is FreeBSD 13.1-p7
That was in a mailman3 server with few lists and traffic. O did the upgrade today in the server that has many lists and hard traffic. When I restarted mailman it showed this trace:
Generating MTA alias maps /usr/local/mailman3 # Traceback (most recent call last): File "/usr/local/bin/runner", line 33, in <module> sys.exit(load_entry_point('mailman==3.3.8', 'console_scripts', 'runner')()) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1130, in __call__ return self.main(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/local/lib/python3.9/site-packages/click/core.py", line 760, in invoke return __callback(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/usr/local/lib/python3.9/site-packages/mailman/bin/runner.py", line 184, in main runner = make_runner(*runner_spec, once=once) File "/usr/local/lib/python3.9/site-packages/mailman/bin/runner.py", line 70, in make_runner return runner_class(name, slice) File "/usr/local/lib/python3.9/site-packages/mailman/runners/lmtp.py", line 295, in __init__ self.lmtp = LMTPController(LMTPHandler(), hostname=hostname, port=port) File "/usr/local/lib/python3.9/site-packages/aiosmtpd/controller.py", line 417, in __init__ self._localhost = get_localhost() File "/usr/local/lib/python3.9/site-packages/aiosmtpd/controller.py", line 66, in get_localhost with makesock(AF_INET6, SOCK_STREAM) as sock: File "/usr/local/lib/python3.9/socket.py", line 232, in __init__ _socket.socket.__init__(self, family, type, proto, fileno) OSError: [Errno 43] Protocol not supported
As Mark pointed it can be circunverted modifying /PATH_TO_YOUR_PYTHON/site-packages/aiosmtpd/controller.py and changing the 49th line as this:
# Helper function to assist in mocking^M
## return has_ipv6^M return False
After that, restarting mailman 3 works perfectly.
It seems that FreeBSD is handling IPv6 in a way that other OSs dont. It surprise me, because FreeBSD was the first OS where IPv6 was deployed, but it is what it is.
Thaks to everybody for your patience, specially Odhiambo and Mark.
@Guillermo Hernandez (Oldno7) <guillermo@querysoft.es>
Thanks for the update. However, I don't think I would entirely blame FreeBSD for this. As Mark pointed out, something did not upgrade completely. This could be some quirk within your FreeBSD ports and you may need to ensure everything related to your Python version is updated. Why am I saying this? I am running MM3 in a virtualenv on FreeBSD (13.1-p6) and I did upgrade to the bleeding-edge MM3 by running all components from git, and I don't have this problem you had. Could you possibly fully update your Python libraries by following the entry dated 20220626 in /usr/ports/UPDATING? Could you run all the steps, do away with the workaround, and see if that fixes the issue?
PS: I don't even think many people are running MM3 on FreeBSD, leave alone from the ports. I have come to learn that even in Linux, using the distro's packages is usually problematic. Running MM3 from virtualenv is quite safe and to be honest, you can migrate your setup from where it is now to a virtualenv and you will not lose anything.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
El 2/4/23 a las 11:12, Odhiambo Washington escribió:
On Sun, Apr 2, 2023 at 11:35 AM Guillermo Hernandez (Oldno7) via Mailman-users<mailman-users@mailman3.org> wrote:
It seems that FreeBSD is handling IPv6 in a way that other OSs dont. It surprise me, because FreeBSD was the first OS where IPv6 was deployed, but it is what it is.
Thaks to everybody for your patience, specially Odhiambo and Mark.
@Guillermo Hernandez (Oldno7)<guillermo@querysoft.es>
Thanks for the update. However, I don't think I would entirely blame FreeBSD for this. As Mark pointed out, something did not upgrade completely. I'm NOT blaming any of the parts involved... Sure, most probably is my fault. But the last upgrade shows that the process that fail is involved with mailman upgrade. The last server was working smoothly and it has higher traffic than the first I tried. It cannot be that I missed that something was not working for weeks (since the last upgrade of the OS) This could be some quirk within your FreeBSD ports and you may need to ensure everything related to your Python version is updated. It could be... but since a year ago I configured a poudriere repository and Im updating from packages, not from ports. But this do not discards your guess Why am I saying this? I am running MM3 in a virtualenv on FreeBSD (13.1-p6) and I did upgrade to the bleeding-edge MM3 by running all components from git, and I don't have this problem you had. Not the same version exactly though. But similar enough Could you possibly fully update your Python libraries by following the entry dated 20220626 in /usr/ports/UPDATING? Could you run all the steps, do away with the workaround, and see if that fixes the issue?
I switched to python 3.9 in early 2022 (or it could be 2021?), that updating point is not applicable here. All my python apps are 3.9. And therefore it would not explain why a server which was working perfectly before this mailman3 upgrade, was falling in this strange IPv6 problem after.
PS: I don't even think many people are running MM3 on FreeBSD, leave alone from the ports.
Well... leaving FreeBSD for apparently greener paths in my servers is not something I'm planning to do. They are running some FreeBSD version since 1993... and then, they are working. I'm not running MM3 from the ports, I installed every bit of it from python tools.
I have come to learn that even in Linux, using the distro's packages is usually problematic. Again, I don't install from any distro package Running MM3 from virtualenv is quite safe and to be honest, you can migrate your setup from where it is now to a virtualenv and you will not lose anything.
And I cannot deny it... but I'm already under one layer of virtualization... the mailman servers run in a jail environment. I don't want to add more layers if I can avoid it.
Thank you very much for your pointings.
Regards
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
On 2023-04-02 12:57:32 +0200 (+0200), Guillermo Hernandez (Oldno7) via Mailman-users wrote: [...]
And I cannot deny it... but I'm already under one layer of virtualization... the mailman servers run in a jail environment. I don't want to add more layers if I can avoid it. [...]
Despite its name, a venv is not really virtualization. It's just a means of isolating Python libraries in such a way that you can create multiple Python environments that contain different versions of libraries without them conflicting with each other, while still pointing back to a common Python interpreter and stdlib.
Jeremy Stanley
El 2/4/23 a las 12:57, Guillermo Hernandez (Oldno7) via Mailman-users escribió:
Running MM3 from virtualenv is quite safe and to be honest, you can migrate your setup from where it is now to a virtualenv and you will not lose anything.
And I cannot deny it... but I'm already under one layer of virtualization... the mailman servers run in a jail environment. I don't want to add more layers if I can avoid it.
Re-reading my own mail makes me think that the jail environment could be the guilty. I'm gonna test it controlling that IPv6 config pass trough the jail (even there is no IPv6 config -localhost is ::1-, it could be that the jailed server could not be allowed to use it). I'll tell you the results.
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
El 2/4/23 a las 14:28, Guillermo Hernandez (Oldno7) via Mailman-users escribió:
El 2/4/23 a las 12:57, Guillermo Hernandez (Oldno7) via Mailman-users escribió:
Running MM3 from virtualenv is quite safe and to be honest, you can migrate your setup from where it is now to a virtualenv and you will not lose anything.
And I cannot deny it... but I'm already under one layer of virtualization... the mailman servers run in a jail environment. I don't want to add more layers if I can avoid it.
Re-reading my own mail makes me think that the jail environment could be the guilty. I'm gonna test it controlling that IPv6 config pass trough the jail (even there is no IPv6 config -localhost is ::1-, it could be that the jailed server could not be allowed to use it). I'll tell you the results.
It was not the jail enviroment(at least for the IPv6 explicit conf). I've tested it and it shows the same error.
I'll leave for the moment at this.
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
On 4/2/23 03:57, Guillermo Hernandez (Oldno7) via Mailman-users wrote:
I'm NOT blaming any of the parts involved... Sure, most probably is my fault. But the last upgrade shows that the process that fail is involved with mailman upgrade. The last server was working smoothly and it has higher traffic than the first I tried. It cannot be that I missed that something was not working for weeks (since the last upgrade of the OS)
It depends on what you did. Mailman's lmtp runner would only encounter this issue at startup, so unless you restarted Mailman or rebooted the server, lmtp runner would have continued without issue even if there was an underlying OS problem.
Also, I don't think the problem is with Mailman per se. The underlying issue is in the Python library socket module. Try the following in a Python 3 shell
$ python3
Python 3.9.16 (main, Dec 11 2022, 12:49:23)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from socket import AF_INET6, SOCK_STREAM, socket as makesock
>>> sock = makesock(AF_INET6, SOCK_STREAM)
>>> sock.bind(("::1", 0))
>>> sock.close()
This is essentially what aiosmtpd does and I expect that sock = makesock(AF_INET6, SOCK_STREAM)
will throw the OSError: [Errno 43] Protocol not supported
exception.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
El 3/4/23 a las 1:25, Mark Sapiro escribió:
On 4/2/23 03:57, Guillermo Hernandez (Oldno7) via Mailman-users wrote:
I'm NOT blaming any of the parts involved... Sure, most probably is my fault. But the last upgrade shows that the process that fail is involved with mailman upgrade. The last server was working smoothly and it has higher traffic than the first I tried. It cannot be that I missed that something was not working for weeks (since the last upgrade of the OS)
It depends on what you did. Mailman's lmtp runner would only encounter this issue at startup, so unless you restarted Mailman or rebooted the server, lmtp runner would have continued without issue even if there was an underlying OS problem.
I thought I said it: I reboot this server everyday at 06:40 CEST time. That's why I'm sure it's not an undetected problem for weeks. The lists in this last upgraded server are with daily traffic. I'm suscribed to all.
Also, I don't think the problem is with Mailman per se. The underlying issue is in the Python library socket module. Try the following in a Python 3 shell
$ python3 Python 3.9.16 (main, Dec 11 2022, 12:49:23) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from socket import AF_INET6, SOCK_STREAM, socket as makesock >>> sock = makesock(AF_INET6, SOCK_STREAM) >>> sock.bind(("::1", 0)) >>> sock.close()
This is essentially what aiosmtpd does and I expect that
sock = makesock(AF_INET6, SOCK_STREAM)
will throw theOSError: [Errno 43] Protocol not supported
exception.
And you are right (ther is more down of this):
Python 3.9.16 (main, Dec 15 2022, 09:41:07) [Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a on freebsd13 Type "help", "copyright", "credits" or "license" for more information.
from socket import AF_INET6, SOCK_STREAM, socket as makesock sock = makesock(AF_INET6, SOCK_STREAM) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/socket.py", line 232, in __init__ _socket.socket.__init__(self, family, type, proto, fileno) OSError: [Errno 43] Protocol not supported
Buuuuuut, if I do the same in the "father" server:
Python 3.9.16 (main, Dec 15 2022, 09:41:07) [Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a on freebsd13 Type "help", "copyright", "credits" or "license" for more information.
from socket import AF_INET6, SOCK_STREAM, socket as makesock sock = makesock(AF_INET6, SOCK_STREAM) sock.bind(("::1", 0)) sock.close() File "<stdin>", line 1 sock.close() IndentationError: unexpected indent sock.close()
The server can open a socket without problem. As I though previously it has to be something with the jailed envviroment. Your test had probe me right (and wrong in my jail tests). It's very valuable. I know now where I can dig more.
Thanks a lot
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
(I left the relevant part of the previous thread at bottom to give context)
(Knowing that this could be of less interest to the majority os suscribers in this list, I write it down for someone that could be searching for a solution out there)
I you have mailman3 in a FreeBSD jailed server, and your lmtp runner stops working after mailman3.3.8 upgrade the most probably cause is the IPv6 config of the jail and the "::1" IP of the localhost.
Disclaimer: I find the next to work, but as I don't use IPv6 (and know nothing about its complexities), it could be a mistaken config. But I asume that if you have the same problem, it is in a no IPv6 aware server, otherwise you would not have this situation.
In the jail config of the parent host I configured explicitily this IPv6 IP
ip6.addr = "::2";
And in the /etc/hosts definitions of the jailed host
#::1 localhost localhost.yourserver.com ::2 localhost localhost.yourserver.com
After that, restarted the jail and the lmpt runner will work again as it's expected
And the rest of the services will work too.
Thanks for your patience.
El 3/4/23 a las 8:02, Guillermo Hernandez (Oldno7) via Mailman-users escribió:
Also, I don't think the problem is with Mailman per se. The underlying issue is in the Python library socket module. Try the following in a Python 3 shell
$ python3 Python 3.9.16 (main, Dec 11 2022, 12:49:23) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from socket import AF_INET6, SOCK_STREAM, socket as makesock >>> sock = makesock(AF_INET6, SOCK_STREAM) >>> sock.bind(("::1", 0)) >>> sock.close()
This is essentially what aiosmtpd does and I expect that
sock = makesock(AF_INET6, SOCK_STREAM)
will throw theOSError: [Errno 43] Protocol not supported
exception.And you are right (ther is more down of this):
Python 3.9.16 (main, Dec 15 2022, 09:41:07) [Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a on freebsd13 Type "help", "copyright", "credits" or "license" for more information.
from socket import AF_INET6, SOCK_STREAM, socket as makesock sock = makesock(AF_INET6, SOCK_STREAM) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/socket.py", line 232, in __init__ _socket.socket.__init__(self, family, type, proto, fileno) OSError: [Errno 43] Protocol not supported
Buuuuuut, if I do the same in the "father" server:
Python 3.9.16 (main, Dec 15 2022, 09:41:07) [Clang 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a on freebsd13 Type "help", "copyright", "credits" or "license" for more information.
from socket import AF_INET6, SOCK_STREAM, socket as makesock sock = makesock(AF_INET6, SOCK_STREAM) sock.bind(("::1", 0)) sock.close() File "<stdin>", line 1 sock.close() IndentationError: unexpected indent sock.close()
The server can open a socket without problem. As I though previously it has to be something with the jailed envviroment. Your test had probe me right (and wrong in my jail tests). It's very valuable. I know now where I can dig more.
Thanks a lot
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
Guillermo Hernandez (Oldno7) wrote:
I thought I said it: I reboot this server everyday at 06:40 CEST time. That's why I'm sure it's not an undetected problem for weeks. The lists in this last upgraded server are with daily traffic. I'm suscribed to all.
I've looked at this a bit further. Prior to Mailman core 3.3.4 we required aiosmtpd>=1.1. In 3.3.4 we required aiosmtpd>=1.4.1 and now we require aiosmtpd>=1.4.3. The code in aiosmtpd that triggers the issue in the socket module was added in aiosmtpd==1.3.1. So it is likely that your prior Mailman core version was <3.3.4 and your aiosmtpd dependency was <1.3.1, so the Mailman upgrade would also have upgraded aiosmtpd to a version which triggered the socket issue.
El 4/4/23 a las 3:31, Mark Sapiro escribió:
Guillermo Hernandez (Oldno7) wrote:
I thought I said it: I reboot this server everyday at 06:40 CEST time. That's why I'm sure it's not an undetected problem for weeks. The lists in this last upgraded server are with daily traffic. I'm suscribed to all.
I've looked at this a bit further. Prior to Mailman core 3.3.4 we required aiosmtpd>=1.1. In 3.3.4 we required aiosmtpd>=1.4.1 and now we require aiosmtpd>=1.4.3. The code in aiosmtpd that triggers the issue in the socket module was added in aiosmtpd==1.3.1. So it is likely that your prior Mailman core version was <3.3.4 and your aiosmtpd dependency was <1.3.1, so the Mailman upgrade would also have upgraded aiosmtpd to a version which triggered the socket issue.
I think tou are completely right about the aiosmtpd changes. But I had mailman 3.3.5 installed since end of september of '21, mailman 3.3.6 since end of october '22, and mailman 3.3.7 since the beginning of december of last year. You can search the list and find my messages about that upgrades and problems I had with them.
Just to make it clear: It happened upgrading from 3.3.7 to 3.3.8
The upgrade procedure I did all the times is
pip install --upgrade django-mailman3 mailman mailman-hyperkitty mailmanclient postorius django hyperkitty uwsgi mod-wsgi
and if I see some trouble I did it with a --force-reinstall parameter (not that I remember it happened last times that I upgraded)
(and then the collectstatic, etc.)
If I missed something, I don't know.
Mailman-users mailing list --mailman-users@mailman3.org To unsubscribe send an email tomailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/ Archived at:https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
This message sent toguillermo@querysoft.es
--
Mailman's content filtering has removed the following MIME parts from this message.
Content-Type: image/png Name: firma-GHP-emails.png
Replaced multipart/alternative part with first alternative.
On 4/3/23 23:12, Guillermo Hernandez (Oldno7) via Mailman-users wrote:
Just to make it clear: It happened upgrading from 3.3.7 to 3.3.8
The upgrade procedure I did all the times is
pip install --upgrade django-mailman3 mailman mailman-hyperkitty mailmanclient postorius django hyperkitty uwsgi mod-wsgi
and if I see some trouble I did it with a --force-reinstall parameter (not that I remember it happened last times that I upgraded)
(and then the collectstatic, etc.)
If I missed something, I don't know.
Mailman 3.3.5, 3.3.6 and 3.3.7 all required aiosmtpd>=1.4.1 so your prior upgrades should have installed aiosmtpd>=1.4.1. Possibly aiosmtpd>=1.4.1 was installed somewhere, but your jail configuration was such that it wasn't the one actually used by lmtp runner.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (4)
-
Guillermo Hernandez (Oldno7)
-
Jeremy Stanley
-
Mark Sapiro
-
Odhiambo Washington