Koozali.org formerly Contribs.org

Mail server is unable to send mails with more than 5 MB attachements

Offline Mar

Hello,
I am using thunderbird as a mail client.
While trying to send mail with more than 4.5 MB it raises the following error:
An error occurred while sending mail. The mail server responded:  Unable to scan for viruses. Please check the message and try again.

Note 1: Attachments  max size is 10MB.
Noe2: When I login using ssh I see clam AV is scanning is running and consuming 99% of CPU.
Is there anything I can do to handle this error.
Regards
Martin

Offline Jean-Philippe Pialasse

  • *
  • 1,362
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #1 on: October 08, 2019, 08:45:06 PM »
1- add more memory
2- disable virus scan (not what i would recommend)


What is the current memory size of this server? Any clamav customization like unofficial sigs installed? 

Offline Mar

Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #2 on: October 08, 2019, 08:52:35 PM »
The current installed memory 8G and only 2 G are used.
There is not lamav customization installed.
2- disable virus scan (not what i would recommend)/if I disabled it does that mean neither of outgoing and incoming mails will not be scanned or the weekly scan will be disabled?
Thanks
Martin

 

Offline Mar

Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #3 on: October 08, 2019, 08:56:31 PM »
In addition, clamscan is using 9.2% as mem

Offline Jean-Philippe Pialasse

  • *
  • 1,362
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #4 on: October 09, 2019, 04:09:24 AM »
forgot one thing first,

usually when we check max message size we think only about
Code: [Select]
config getprop spamassassin MaxMessageSize
there is another limit for email filtering, the attachment size to scan:

Code: [Select]
$max_size = $qpsmtpd{MaxScannerSize} ||
                   $clamav{StreamMaxLength} ||
                   "25M";

you can get your actual scan limit by issuing :
Code: [Select]
config getprop qpsmtpd MaxScannerSize default 25000000, ie 25M so it should not bother.


probably this one is 5M on your server...

and

Code: [Select]
config getprop clamav StreamMaxLengthdefault not set


Finally you might get two other limits :

Code: [Select]
config get clamd MemLimitwhich could give an error because clamav has not enough memory when you use unofficial signatures..

and also
Code: [Select]
config getprop clamav MaxFileSizewhich should not be related to streams... but in case...




========

now if those are not enough to find the issue :


The current installed memory 8G and only 2 G are used.
what does shows htop with memory sorted as decreasing when you send a refused email.

what also gives
Code: [Select]
tail -f /var/log/sqpsmtpd/current |tai64nlocal
and

Code: [Select]
tail -f /var/log/clamd/current |tai64nlocal
There is not clamav customization installed.

ok

2- disable virus scan (not what i would recommend)/if I disabled it does that mean neither of outgoing and incoming mails will not be scanned or the weekly scan will be disabled?
Thanks
Martin
as you are supposed to send email  you could change the configuration for  LAN


/etc/e-smith/templates/var/service/qpsmtpd/config/peers/local/80clamav
Of course create a template customs... and modify


Offline Mar

Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #5 on: October 09, 2019, 08:24:46 AM »
Thank you very much all default values are fine, 25, 15 MB noting is wrong here
service|MemLimit|1800000000|status|enabled

But when I ran: tail -f /var/log/clamd/current |tai64nlocal
I got the following which seems something is wrong:
2019-10-09 08:05:22.419358500 /var/spool/qpsmtpd/1570601113:24821:0: Can't allocate memory ERROR
2019-10-09 08:06:26.171321500 LibClamAV Warning: fmap: map allocation failed
2019-10-09 08:06:26.171323500 LibClamAV Error: CRITICAL: fmap() failed
2019-10-09 08:06:26.171347500 /var/spool/qpsmtpd/1570601174:24909:0: Can't allocate memory ERROR
2019-10-09 08:07:22.552594500 LibClamAV Warning: fmap: map allocation failed
2019-10-09 08:07:22.552596500 LibClamAV Error: CRITICAL: fmap() failed
2019-10-09 08:07:22.552633500 /var/spool/qpsmtpd/1570601233:24930:0: Can't allocate memory ERROR
2019-10-09 08:08:22.513552500 LibClamAV Warning: fmap: map allocation failed
2019-10-09 08:08:22.513554500 LibClamAV Error: CRITICAL: fmap() failed
2019-10-09 08:08:22.514352500 /var/spool/qpsmtpd/1570601293:24961:0: Can't allocate memory ERROR
2019-10-09 08:09:32.451938500 LibClamAV Warning: fmap: map allocation failed
2019-10-09 08:09:32.451940500 LibClamAV Error: CRITICAL: fmap() failed
2019-10-09 08:09:32.453246500 /var/spool/qpsmtpd/1570601363:25007:0: Can't allocate memory ERROR

So any suggestion here?
Regards
Martin
« Last Edit: October 09, 2019, 08:38:21 AM by Mar »

Offline Mar

Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #6 on: October 09, 2019, 08:45:34 AM »
Now it works.
Solved after I increased the mem limit:

db configuration setprop clamd MemLimit 1800000000
signal-event clamav-update

Thank you very much

Offline mmccarn

  • *
  • 2,445
Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #7 on: October 09, 2019, 12:37:01 PM »
I've added a note about clamd MemLimit on the Email page on the wiki -
https://wiki.contribs.org/Email#Set_max_email_size

Offline Mar

Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #8 on: October 09, 2019, 12:45:25 PM »
Thank you all.

Offline Jean-Philippe Pialasse

  • *
  • 1,362
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Mail server is unable to send mails with more than 5 MB attachements
« Reply #9 on: October 10, 2019, 12:40:57 AM »
Code: [Select]
cat /etc/e-smith/db/configuration/defaults/clamd/MemLimit
1400000000

default value is 1.4GB

from what I understand you rised it to :1.8GB (1800000000)

this might need opeining a bug if anyone is able to reproduce, this means the db has grows againa nd we should increase the default