Out of memory: Kill process clamd / amavisd

February 5, 2014 17.1k views
my server is running well for a while then suddenly the service clamd.amavisd failed and cannot start. it say the pid is exist but failed to start and i trace my server. and i suspect it seems memory issue that's why it terminate clamd.amavisd failed to start (it will work normally back again once i reboot the machine). last time my server is only 700 MB but can run clamav with no issue. and now almost 1 gb and has issue. how to fix it? please help many thanks. [root@us1 05]# tail -f /var/log/maillog Feb 4 10:24:23 us1 amavis[16189]: (16189-01) (!)connect to /var/spool/amavisd/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/spool/amavisd/clamd.sock: 111 Feb 4 10:24:24 us1 amavis[16189]: (16189-01) (!)connect to /var/spool/amavisd/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/spool/amavisd/clamd.sock: Connection refused Feb 4 10:24:24 us1 amavis[16189]: (16189-01) (!)ClamAV-clamd: All attempts (1) failed connecting to /var/spool/amavisd/clamd.sock, retrying (2) Feb 4 10:24:30 us1 amavis[16189]: (16189-01) (!)connect to /var/spool/amavisd/clamd.sock failed, attempt #1: Can't connect to UNIX socket /var/spool/amavisd/clamd.sock: Connection refused Feb 4 10:24:30 us1 amavis[16189]: (16189-01) (!)ClamAV-clamd av-scanner FAILED: run_av error: Too many retries to talk to /var/spool/amavisd/clamd.sock (All attempts (1) failed connecting to /var/spool/amavisd/clamd.sock) at (eval 113) line 600.\n Feb 4 10:24:30 us1 amavis[16189]: (16189-01) (!)WARN: all primary virus scanners failed, considering backups [root@us1 05]# cat /proc/meminfo MemTotal: 1020400 kB MemFree: 69272 kB Buffers: 3316 kB Cached: 24264 kB SwapCached: 76988 kB Active: 435740 kB Inactive: 445112 kB Active(anon): 424344 kB Inactive(anon): 428988 kB Active(file): 11396 kB Inactive(file): 16124 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 1048568 kB SwapFree: 581576 kB Dirty: 192 kB Writeback: 0 kB AnonPages: 801232 kB Mapped: 11912 kB Shmem: 12 kB Slab: 37264 kB SReclaimable: 12648 kB SUnreclaim: 24616 kB KernelStack: 1184 kB PageTables: 16912 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 1558768 kB Committed_AS: 1859408 kB VmallocTotal: 34359738367 kB VmallocUsed: 7324 kB VmallocChunk: 34359726292 kB HardwareCorrupted: 0 kB AnonHugePages: 55296 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 8184 kB DirectMap2M: 1040384 kB [root@us1 05]# grep -i kill /var/log/messages* | more /var/log/messages:Feb 4 09:40:02 us1 kernel: php invoked oom-killer: gfp_mask=0 x280da, order=0, oom_adj=0, oom_score_adj=0 /var/log/messages:Feb 4 09:40:02 us1 kernel: [] ? oom_kill_pr ocess+0x82/0x2a0 /var/log/messages:Feb 4 09:40:02 us1 kernel: Out of memory: Kill process 2442 ( clamd) score 118 or sacrifice child /var/log/messages:Feb 4 09:40:02 us1 kernel: Killed process 2442, UID 494, (cla md) total-vm:507364kB, anon-rss:13376kB, file-rss:4kB /var/log/messages:Feb 4 10:25:39 us1 kernel: clamd invoked oom-killer: gfp_mask =0x201da, order=0, oom_adj=0, oom_score_adj=0 /var/log/messages:Feb 4 10:25:39 us1 kernel: [] ? oom_kill_pr ocess+0x82/0x2a0 /var/log/messages:Feb 4 10:25:39 us1 kernel: Out of memory: Kill process 6213 ( amavisd) score 47 or sacrifice child /var/log/messages:Feb 4 10:25:39 us1 kernel: Killed process 6213, UID 494, (ama visd) total-vm:341332kB, anon-rss:5504kB, file-rss:8kB /var/log/messages:Feb 4 10:25:41 us1 kernel: clamd invoked oom-killer: gfp_mask =0x201da, order=0, oom_adj=0, oom_score_adj=0 /var/log/messages:Feb 4 10:25:41 us1 kernel: [] ? oom_kill_pr ocess+0x82/0x2a0 /var/log/messages:Feb 4 10:25:41 us1 kernel: Out of memory: Kill process 16872 (clamd) score 48 or sacrifice child /var/log/messages:Feb 4 10:25:41 us1 kernel: Killed process 16872, UID 494, (cl amd) total-vm:125252kB, anon-rss:100376kB, file-rss:72kB /var/log/messages:Feb 4 10:25:55 us1 kernel: clamd invoked oom-killer: gfp_mask =0x201da, order=0, oom_adj=0, oom_score_adj=0 /var/log/messages:Feb 4 10:25:55 us1 kernel: [] ? oom_kill_pr ocess+0x82/0x2a0 /var/log/messages:Feb 4 10:25:55 us1 kernel: Out of memory: Kill process 16189 (amavisd) score 44 or sacrifice child
3 Answers
if you are out of memory, just restart your droplet power.

Then run the following command to see how much used and under use:

* free
or
* free -v
/var/log/messages:Feb 4 10:25:55 us1 kernel: Out of memory: Kill process 16189
(amavisd) score 44 or sacrifice child

Out of memory

You need to either upgrade your droplet or add swap: https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04.
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
Hi
currently my swap file is 1 GB memory is 1 GB.
my server is running zpanel+suhosin+clamd+amavisd+wordpress multiuser+whmcs
may i know what is the recommended if i want to upgrade my memory?
is there any limit to wordpress? because i saw this error message

today it happen again.
Feb 12 22:53:10 us1 rsyslogd-2177: imuxsock begins to drop messages from pid 1121 due to rate-limiting
Feb 12 22:53:41 us1 suhosin[3545]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker '157.55.34.29', file '/var/zpanel/hostdata/agus/public_html/durianmedan_com/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php', line 115)
Feb 12 22:58:08 us1 rsyslogd-2177: imuxsock lost 13 messages from pid 1121 due to rate-limiting
Feb 12 22:58:09 us1 rsyslogd-2177: imuxsock begins to drop messages from pid 1121 due to rate-limiting
Feb 12 23:00:03 us1 rsyslogd-2177: imuxsock lost 235 messages from pid 1121 due to rate-limiting
Feb 12 23:00:07 us1 suhosin[3545]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker '82.145.217.195', file '/var/zpanel/hostdata/agus/public_html/durianmedan_com/wp-content/plugins/all-in-one-seo-pack/all_in_one_seo_pack.php', line 115)
Feb 12 23:01:11 us1 named[913]: error (network unreachable) resolving 'dlv.isc.org/DNSKEY/IN': 2001:4f8:0:2::19#53
Feb 12 23:01:11 us1 named[913]: error (network unreachable) resolving 'dlv.isc.org/DNSKEY/IN': 2001:500:60::30#53
Feb 12 23:01:11 us1 named[913]: error (network unreachable) resolving 'dlv.isc.org/DNSKEY/IN': 2001:500:60::29#53

and
clamd dead but subsys locked

thanks
regards
agus halim
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!