question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Amavis stops working after finishing max_requests

See original GitHub issue

Impacted versions

  • OS Type: Debian
  • OS Version: 11
  • Database Type: PostgreSQL
  • Database version: 13.4
  • Modoboa: 1.17.0
  • installer used: No
  • Webserver: Nginx

Steps to reproduce

  • Have postfix+amavis setup running as intended by the installer
  • Have $max_servers = 1; in /etc/amavis/conf.d/50-user
  • See amavis closing the process after processing 20 requests (default setting)
  • Notice amavis stopping

Current behavior

With the setup as configured by modoboa-installer amavis will run with a single master process. Amavis will kill its process after a configured number of processed messages (this number is 20 by default), after which Net::Server should start a new process.

After I upgraded to Debian 11 this behaviour seems broken - the limit is reached, the current process is terminated, but no new process is spawned:

Oct 11 12:51:39 mailserver amavisd-new[4150261]: Oct 11 12:51:39.429 mailserver /usr/sbin/amavisd-new[4150261]: (4150261-20) Requesting process rundown after 20 tasks (and 20 sessions)

Once amavis has cleaned up after receiving SIGTERM the whole unit comes to a stop:

Oct 11 12:51:40 mailserver systemd[1]: amavis.service: Succeeded.
Oct 11 12:51:40 mailserver systemd[1]: amavis.service: Consumed 14.497s CPU time.

As amavis is correctly configured as a proxy_filter in postfix, this results in all incoming mails bouncing.

Expected behavior

The Amavis unit stays alive after planned process rundown.

Possible fix

I still have to run some tests, but I increased the $max_proesses to any number bigger than 1 which results in amavis spawning actual child processes which can then be terminated and restarted without issue (I checked this by limiting $max_requests to 1 forcing amavis to restart a child after processing a single mail).

Theoretically smtpd processes will wait for amavis processes to become available, allowing mail clients to terminate a submission if it takes too long (as the smtpd process waits for amavis to finish) so increasing max_servers should be fine.

But I haven’t been able to figure out why amavis doesn’t spawn a single child process (which it can then restart) and instead uses the master process which (in essence) terminates itself after 20 tasks have been completed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
whirmcommented, Apr 8, 2022

@PatTheMav Thanks for sharing your debug work, you saved me a lot of time!

0reactions
PatTheMavcommented, Apr 11, 2022

TBF, if you don’t use the installer and compose your own custom modoboa setup, you’re kinda on your own in figuring out all the bits and pieces work as intended. Took me ages to actually go and check the systemd unit file - but always good to have learnt something. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

View topic - amavisd-new not cleaning up after checking mail
I have interesting problem, after amavisd-new unpacks mail into /var/amavis/tmp and ... Runtime working directory (cwd), and a place where
Read more >
Amavis service Stopped [SOLVED] - NethServer Community
I did some checks and I have noticed that Amavisd service is stopped. Trying to start manually the service it stops immediately. Any...
Read more >
(!)Amavis::END: DB unregistering failed · Issue #2475 - GitHub
I wrote something wrong. When the system crashes, I receive a system email with the error "queue file write error" but not for...
Read more >
amavisd keeps crashing/refusing connections stopping all ...
Hello, before I upgraded to Debian 11 I had a 2GB RAM VPS running iredmail with amavisd, clamav, and spamassasin just fine. However...
Read more >
Amavisd not starting after upgrade from v8.0.x to ... - Zimbra Wiki
To resolve this, we'll have to update the database. If the server has Internet access then running sa-update will resolve the issue: su...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found