Cisco-Talos / clamav

ClamAV - Documentation is here: https://docs.clamav.net
https://www.clamav.net/
GNU General Public License v2.0
4.38k stars 703 forks source link

too much RAM is being used #565

Open NikNikYkt opened 2 years ago

NikNikYkt commented 2 years ago

root@ovz10:~# clamconf -n Checking configuration files in /usr/local/etc

clamd.conf not found

Config file: freshclam.conf

LogFileMaxSize = "4294967295" LogTime = "yes" LogRotate = "yes" DatabaseDirectory = "/var/lib/clamav" UpdateLogFile = "/var/log/clamav/freshclam.log" Checks = "1" DatabaseMirror = "db.ru.clamav.net", "db.local.clamav.net", "database.clamav.net" PrivateMirror = "clmvupd.deltamoby.ru" MaxAttempts = "5" ScriptedUpdates disabled NotifyClamd = "/etc/clamav/clamd.conf"

clamav-milter.conf not found

Software settings

Version: 0.104.2 Optional features supported: MEMPOOL AUTOIT_EA06 BZIP2 LIBXML2 PCRE2 ICONV JSON RAR

Database information

Database directory: /var/lib/clamav WARNING: freshclam.conf and clamd.conf point to different database directories daily.cvd: version 26525, sigs: 1981764, built on Wed Apr 27 17:19:41 2022 main.cvd: version 62, sigs: 6647427, built on Thu Sep 16 21:32:42 2021 bytecode.cvd: version 333, sigs: 92, built on Tue Mar 9 00:21:51 2021 Total number of signatures: 8629283

Platform information

uname: Linux 4.9.0 #1 SMP Tue Jan 25 12:49:12 MSK 2022 x86_64 OS: Linux, ARCH: x86_64, CPU: x86_64 Full OS version: Debian GNU/Linux 9.13 (stretch) zlib version: 1.2.11 (1.2.11), compile flags: a9 platform id: 0x0a218e8e0800000000050400

Build information

GNU C: 5.4.0 20160609 (5.4.0) sizeof(void*) = 8 Engine flevel: 142, dconf: 142

Hi 👋 the screenshots show the amount of RAM that is occupied by ClamAV. I have only one question, the answer to which I need from the developer community directly - is this normal RAM consumption or something went wrong? just in case, I put data from the logs (of the system and ClamAV itself). Thanks in advance. Translated with google translator IMG_20220430_115413 IMG_20220430_120216_677 IMG_20220430_082114 htop: IMG_20220430_185920_401

mjholub commented 2 years ago

Experiencing this as well. On Alpine it is over 700 MB and on Manjaro 1.2GiB. Stack trace for Manjaro, where it additionally crashed, and for Alpine. Might be some nasty mem leak.

dilyanpalauzov commented 2 years ago

I have

# systemctl status clamd
● clamd.service - clamd
     Loaded: loaded (/usr/local/lib/systemd/system/clamd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-04-25 01:58:17 UTC; 1 week 6 days ago
   Main PID: 508 (clamd)
      Tasks: 4 (limit: 9550)
     Memory: 1.6G
        CPU: 48min 21.020s
     CGroup: /system.slice/clamd.service
             └─508 /usr/local/sbin/clamd -F

Apr 25 01:57:11 mail systemd[1]: Starting clamd...
Apr 25 01:58:17 mail systemd[1]: Started clamd.
GWHAYWOOD commented 2 years ago

https://docs.clamav.net/Introduction.html?highlight=system%20requirements#recommended-system-requirements

This question would perhaps have been better taken to the users' mailing list.

Even if you only use the 'official' ClamAV signatures you can expect the scanner to use more than a gigabyte of RAM.

micahsnyder commented 2 years ago

We are working on ways to trim older signatures from the database based on detection rates, specifically to bring down the memory usage. But we're still a ways out from being able to make any changes. So I have refrained from promising anything here or in the mailing list.

I expect that you will always need at least 2GB of RAM to run ClamD. But for now, 3GB or even 4GB is required, particularly if you want concurrent database reloads and FreshClam database checking.

dilyanpalauzov commented 2 years ago

The ConcurrentDatabaseReload option allows reducing memory, during database reload. Can you please clarify, what happens with clamav-milter, while the database is reloaded non-concurrently. Does it defer email (return 4xx error, so that the sending server retries later)?

GWHAYWOOD commented 2 years ago

It depends on the configuration(s), see the documentation e.g. 'man clamav-milter.conf'.

Theoretically, also, settings in the clamav-milter configuration file could be overridden by the configuration of the MTA.