Author Topic: CPU 100% clamd  (Read 18207 times)

0 Members and 1 Guest are viewing this topic.

Offline
**
Re: CPU 100% clamd
« Reply #15 on: January 10, 2020, 12:17:58 AM »
alternative solution

- admin panel
- mail services
- ClamAV
- Stop
- File Manager
- /var/run/clamd.amavisd/
- clamd.sock permission 755
-  back admin panel
-  mail services
- ClamAV
- Start

Well done!
  • Spamassassin: config and scan per mailbox
  • Clustering manager
  • Mail Space Usage
  • All Space Usage + = Disk Space Usage
  • Mail Scanner
    hopeful fourth year

Offline
*
Re: CPU 100% clamd
« Reply #16 on: April 20, 2020, 07:51:14 PM »
Same issue.
Tried script above - didn't help.

Then I tried the alternate solution above - also failed.
There is no clamd.sock file in /var/run/clamd.amavisd/.
Anyway I've assigned 755 to /var/run/clamd.amavisd/ and to /var/run/clamd.scan/ that didn't help.

Then I checked /var/log/messages:

It has cycled error:
Apr 20 23:19:01 cwp systemd: Started clamd scanner () daemon.
Apr 20 23:19:01 cwp clamd: LibClamAV Warning: **************************************************
Apr 20 23:19:01 cwp clamd: LibClamAV Warning: ***  The virus database is older than 7 days!  ***
Apr 20 23:19:01 cwp clamd: LibClamAV Warning: ***   Please update it as soon as possible.    ***
Apr 20 23:19:01 cwp clamd: LibClamAV Warning: **************************************************
Apr 20 23:19:09 cwp clamd: LibClamAV Error: mpool_malloc(): Can't allocate memory (262144 bytes).
Apr 20 23:19:09 cwp clamd: LibClamAV Error: cli_ac_addpatt: Can't allocate memory for new->trans
Apr 20 23:19:09 cwp clamd: LibClamAV Error: cli_parse_add(): Problem adding signature (3).
Apr 20 23:19:09 cwp clamd: LibClamAV Error: Problem parsing database at line 64534
Apr 20 23:19:09 cwp clamd: LibClamAV Error: Can't load daily.ldb: Can't allocate memory
Apr 20 23:19:09 cwp clamd: LibClamAV Error: cli_tgzload: Can't load daily.ldb
Apr 20 23:19:09 cwp clamd: LibClamAV Error: Can't load /var/lib/clamav/daily.cvd: Malformed database
Apr 20 23:19:09 cwp clamd: LibClamAV Error: cli_loaddbdir(): error loading database /var/lib/clamav/daily.cvd
Apr 20 23:19:09 cwp clamd: ERROR: Malformed database
Apr 20 23:19:09 cwp systemd: clamd.service: main process exited, code=exited, status=1/FAILURE
Apr 20 23:19:09 cwp systemd: Unit clamd.service entered failed state.
Apr 20 23:19:09 cwp systemd: clamd.service failed.
Apr 20 23:19:10 cwp systemd: clamd.service holdoff time over, scheduling restart.
Apr 20 23:19:10 cwp systemd: Stopped clamd scanner () daemon.

From it it's clear that it fails to extract signature database daily.ldb because it Can't allocate memory.
The same I see in the usage resources (I have 1 GB RAM on VPS) - normally 0.5 GB is consumed, after ClamAV start it raises from 0.5 to max and restarts.

Is there any way to load the db file on 1 GB RAM?
« Last Edit: April 20, 2020, 08:27:30 PM by Hardoman »

Offline
*****
Re: CPU 100% clamd
« Reply #17 on: April 21, 2020, 10:00:11 AM »
you need to wait for a little after running the script.

Offline
*
Re: CPU 100% clamd
« Reply #18 on: April 21, 2020, 10:27:55 AM »
Do I need to stop services before running a script?

Offline
***
Re: CPU 100% clamd
« Reply #19 on: April 21, 2020, 06:04:52 PM »
The one thing none of you are posting is your system specs.  If you only have a 1 core 1ghz process you really can't run ClamV.  I personally wouldn't run a mail server on anything less than 2 cores, preferabble 4 cores.
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: CPU 100% clamd
« Reply #20 on: May 07, 2020, 07:59:21 PM »
I have had this problem a couple of times now. It seems to occur following a Yum Update.

The first time petrosvels solution worked for me:

# systemctl stop clamd.service
# rm -f /var/run/clamd.amavisd/clamd.sock
# systemctl start clamd.service


The problem is in the error message from the postfix log (var/log/maillog) - ERROR: LOCAL: Socket file /var/run/clamd.amavisd/clamd.sock is in use by another process. Deleting the file clamd.sock is what is required to fix the problem.

The above didn't fix the problem straight away on the most recent occasion, so what I did was:

  • From the CWP Dashboard - stop ClamAV
  • stop AMaViS (A Mail Virus Scanner)
  • Waited until USER amavis no longer appeared in the Top 5 Processes list and the 1 minute load average dropped back to normal levels (below 0.1 in my case). This is probably not necessary, but I did it anyway to be absolutely sure amavis/clamd were not running.
  • Open Filemanager and browse to the folder /var/run/clamd.amavisd. Delete the file clamd.sock. It was an empty file (0 bytes)
  • From the CWP Dashboard Start AMaViS
  • Start ClamAV

If that does not fix the problem, check the postfix log for other possible causes:

# tail -100 var/log/maillog | grep clamd

Thank you all
                              ================//============

PS.*[I leave an administration idea]*
      [ I leave here an Idea, It would be good to have a premium for those who help more in the forum]


 [And a big hug to MR. rcschaff Because it is an excellent support in the Forum, for aselha (difficulties) like me.]
                             
                              ===============//=============


My server CentOS Linux release 7.8.2003 (Core)   CWPpro version: 0.9.8.971

very good | five start***** Tutorial

Your tutorial helped me a lot thanks ***(RESOLVED)***

« Last Edit: May 07, 2020, 08:32:45 PM by jony »
Luis jony

Offline
*
Re: CPU 100% clamd
« Reply #21 on: May 07, 2020, 09:57:41 PM »
Edit /usr/lib/systemd/system/clamd.service

Code: [Select]
[Unit]
Description = clamd scanner (%i) daemon
Documentation=man:clamd(8) man:clamd.conf(5) https://www.clamav.net/documents/
After = syslog.target nss-lookup.target network.target

[Service]
Type = simple
ExecStart = /usr/sbin/clamd -c /etc/clamd.d/amavisd.conf --foreground=yes
# Reload the database
ExecReload = /bin/kill -USR2 $MAINPID
Restart = on-failure
TimeoutStartSec = 420
IOSchedulingPriority = 7
CPUSchedulingPolicy = 5
MemoryLimit = 768M
CPUQuota = 25%
Nice = 19

[Install]
WantedBy = multi-user.target

Code: [Select]
systemctl daemon-reload
systemctl restart clamd
« Last Edit: May 07, 2020, 10:00:26 PM by cinique »

Offline
*
Re: CPU 100% clamd
« Reply #22 on: May 08, 2020, 07:24:58 AM »
You got any running monit or chkroot stuff?