Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pyzor crashes on Ubuntu 22 server restart #167

Open
erlandl4g opened this issue Feb 8, 2024 · 4 comments
Open

Pyzor crashes on Ubuntu 22 server restart #167

erlandl4g opened this issue Feb 8, 2024 · 4 comments

Comments

@erlandl4g
Copy link

Version information

Spamassassin 3.4.6
pyzor 1.0.0

Steps to replicate

  1. Restart the whole email server

Actual result

Pyzor crashes twice on startup most likely due to a start before network is initialized as error reported is DNS related:

File "/usr/lib/python3/dist-packages/pyzor/client.py", line 116, in check
sock = self.send(msg, address)
File "/usr/lib/python3/dist-packages/pyzor/client.py", line 138, in send
return self._send(msg, address)
File "/usr/lib/python3/dist-packages/pyzor/client.py", line 143, in _send
for res in socket.getaddrinfo(addr[0], addr[1], 0, socket.SOCK_DGRAM,
File "/usr/lib/python3.10/socket.py", line 955, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution

crash_report.zip

@mnalis
Copy link

mnalis commented Feb 21, 2024

most likely due to a start before network is initialized as error reported is DNS related

That sounds like a good guess. Pyzor does require full networking (including DNS resolving) to be working before it can accomplish its tasks. Trying to run pyzor before network is ready will result in it not working (i.e. crashing).

If the network not being completely up by the time pyzor is being run, that is the issue with startup system of your distribution, so you should probably report the issue there instead (e.g. if pyzor is being run from spamd, then spamd service startup should be delayed until network is ready - and how to accomplish that depends on the exact init system being used).

(do link from this issue to Ubuntu one, and back, if you decide to open the issue there, to help people stumbling upon that issue too)

@erlandl4g
Copy link
Author

I have actually reported it to Spamassassin beforehand but it was closed there as irrelevant: https://bz.apache.org/SpamAssassin/show_bug.cgi?id=8215

@mnalis
Copy link

mnalis commented Feb 25, 2024

I have actually reported it to Spamassassin beforehand but it was closed there as irrelevant

Yes, that is not an Spamassassin issue either.

It is (in your case) an Ubuntu issue, specifically one of how Ubuntu manages startup files, and SA startup file especially (as that is the one that calls Pyzor, Razor, DCC, RBLs etc -- none of which will work without working network connection being established first).

So you should thus open ticket at Ubuntu, and mention which init system you are using (systemd, upstart, SysVinit, ... - I don't use Ubuntu so I don't know what is offered these days) as that will be the relevant additional piece of information there (along with specific versions of all Ubuntu packages involved, of course).

Please do link that Ubuntu issue here when you create it, so interested parties can follow along.


What I guess is happening (but would need debug startup logs to confirm):

  1. init system starts (probably systemd those days in Ubuntu)
  2. init system parses startup files
  3. init system decides to start networking in background
  4. init system decides to start MTA (like exim, postfix, sendmail, ...) in background
  5. init system decides to start spamassassin in background (in parallel with already running startup scripts)
  6. init system finishes starting up spamassassin
  7. init system finishes starting MTA
  8. MTA delivers previously queued mail to spamassassin to process
  9. spamassassin calls pyzor
  10. pyzor bails out with error as networking has not finished starting up yet (might be unrelated issue - why your network takes longer then usual to start?)
  11. networking finally starts
  12. MTA delivers (new) mail to spamassassin to process
  13. spamassassin calls pyzor again
  14. as network is now working, this and subsequent calls to pyzor work just fine

The issue is likely that step 5. (init system decides to start spamassassin) should have been delayed until network startup is finished (i.e. step 11. in example above), as spamassassin with network test enabled (like pyzor) requires networking to be working beforehand.

@erlandl4g
Copy link
Author

Got it posted at https://bugs.launchpad.net/ubuntu/+source/pyzor/+bug/2055253 and also submitted crash report to Ubuntu with a command:

ubuntu-bug _usr_bin_pyzor.122.crash

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

No branches or pull requests

2 participants